Would it be possible to have a giant, made of stone for example, that would be 40km tall? Would the earth or even his legs be able to hold him? And if not, what would be the tallest plausible height for a giant?
I'd love to go into great detail on this, but the simple answer is: no, it's not possible, at least not in a way that we would recognize as life.
The most basic principle at work is this: volume increases proportionally more than surface area as the size of something increases, so for a perceived general size increase, the volume contained is much more increased. You'll very quickly reach a point where organs like hearts and other muscles don't have the strength to function under the load -- a heart with X surface area of contracting muscles just can't pump Y volume of blood.
With something like a tree, eventually no matter how thick the tree is at the base, the bonds that hold the cells together will be unable to resist the force exerted by the mass above them, and the tree will snap.
You can play around with the design of such a creature, but if you want them to be roughly human-proportioned, there's a reason that the tallest humans cap out below 9 feet (and those that get close tend to die young). Even if it were just a piece of carved stone, that giant hand you described would snap off if you tried to support it in the air from the wrist.
This question, on behalf of a 6Km-tall giant, was answered here. But, let's take on the 40Km giant.
This giant would have the weight of several large mountains. Continental crust is on average 30Km thick. If you waked across cardboard nearly as thick as you are tall, you'd bounce, but never punch through, so we're safe. However, every step would cause a crater hundreds or more meters deep and depress the tectonic plate. Walking next to a fault would cause volcanism and if it's a small plate I can imagine tipping it and sliding into the molten core, like walking too close to the edge of a floating block of ice you're standing on.
The deepest point in the ocean is only 11Km so your giant may be tempted to walk to another continent. However, the oceanic crust is only 5Km thick and that does represent a punch-through-the-crust-with-each-step problem.
Your giant wouldn't just disrupt weather patterns, he'd create them. Whether standing still or moving. I can't prove it, but I wouldn't be surprised if tornadoes and thunderstorms formed in his passing.
He'd never know about any other living thing on the planet other than to perceive it (that is, all life) as some kind of odd lichen against the surface. Something thin and inconsequential as he drags his finger through the soil and pushed mountains around.
What's the tallest plausible height for a giant?
Maybe 9 feet. After that you're throwing more and more of "plausible" to the wind at an exponential rate. At 600 feet (183 meters) the average human would be shorter than the top of his foot and have little more consequence than a worm or a spider to us. A tall mountain local to me is 15,000 feet above sea level. The valley I live in is 4,000 feet, so a giant able to look over the top of that mountain need only be 11,000 feet (3.3Km).
But, is any of this plausible? Not in the slightest. At this time, the tallest dinosaur was Sauroposeidon at 18.5 meters (60 feet). I think that would be difficult to swallow, but at least there's proof to suggest it's plausible. I'm going to call that the max plausible height.