The metal doesn’t explode. The metal reacts with the water, grabbing up OH- in the water and generating lots of heat (you know how magnets jump together when they get close, similar, but the pushing and shoving of water molecules in the process cause heat). Grabbing up the OH- releases hydrogen gas. It just so happens that hydrogen gas burns – violently – in the presence of oxygen (from the air) and heat (in this case, from the metal contacting water).
When you see the explosion when you toss these metals into water, what is happening is that heat and hydrogen gas are being made (and a metal hydroxide), and if there’s enough heat and enough oxygen, the hydrogen explodes.
Latest Answers