There's electronegativity and then there's electropositivity. Electronegativity is the tendency of a substance to gain electrons and electropositivity on similar grounds is the tendency to donate electrons. What actually is a redox reaction? Exchange of electrons?
A substance with high electronegativity would like to snatch any electron it finds, while a substance with high electropositivity would like to force-fully hand over its electrons, however unwilling the substance on the receiving end may be. Metals are electropositive.
how do metals replace hydrogen in a substance such as water. Isn't water happy with its configuration?
There was water, it was living happily. Now, water had two components. Oxygen and hydrogen. Let's pull up their electronegativities. Oxygen is at $3.44$ and hydrogen is at $2.2$. This means that the bond that oxygen and hydrogen shared in water was a polar bond. Oxygen being powerful (higher electronegativity) kept the bond in it's favor. The electrons of the bond were more towards oxygen. This gave oxygen a partial negative charge ($\delta -$) and hydrogen a partial positive charge ($\delta+$).
In came a metal which was highly electropositive (think alkali metals, as an example you can take up sodium whose electronegativity is at $0.93$). He gave oxygen a tempting offer:
"Oxygen, you seem to be caught up in a tussle, look at hydrogen, he doesn't want a positive charge because he's quite electronegative. You're constantly fighting with him to keep the electrons of the bond pair pulled towards yourself. Why don't you pair up with me? I'm low at electronegativity. This means I'm electropositive. As much as electropositive species like bearing a negative charge, we electropositive species like bearing a positive charge!"
And oxygen was greedy. A greater difference in electronegativities of elements forming the bond meant a bond which would be richer in ionic character, which appealed to oxygen.