Magnesium reacts with hot water to form magnesium hydroxide and hydrogen. It starts floating due to the bubbles of hydrogen gas sticking to its surface.