Because some metals are highly reactive and others are not.
Reactivity is usually governed by an atoms ability to lose an electron or an atoms readiness to accept an electron in its outermost electron orbits. This is because atoms are at their most stable when they have a full outer shell of electrons (8 for any atom that has more than two electrons).
Actually the metals do not explode Some metals produce large amounts of hydrogen gas that explodes. Other metals produce little or no hydrogen gas.
Metals that are more active than Hydrogen will replace Hydrogen in water
Hydrogen gas is very explosive and as these reactions are highly exothermic there is usually enough heat to spark the explosion of Hydrogen gas.
Metals that are less active than Hydrogen will not replace the Hydrogen in a single replacement reaction. No reaction with water will occur and no Hydrogen gas will be produced. Without the Hydrogen gas to react with Oxygen gas no explosion is possible.
Metals that are only slightly more active than Hydrogen produce Hydrogen gas but usually rapidly enough to produce a concentration of Hydrogen gas or enough neat to spark an explosion.