Iron is a dense, silvery-grey metal. It is the most widely used of all the metal elements because it is common, is cheap to produce from its ores, can be bent while cold, and is strong. However, some of its properties are less welcome. For example, it is quite reactive, especially with air and water, a process called corrosion. The reactivity of iron Some metals are more reactive than others.
Copper is near the bottom of the reactivity series, while iron is higher up.
Therefore iron will always corrode when placed in a solution containing a copper compound such as copper sulphate. On the other hand, iron is below magnesium, which is why magnesium will always corrode when placed next to iron. The red colour is caused by an indicator in the water. The clear water shows a neutral reaction. As the magnesium corrodes it produces magnesium hydroxide, an alkali, which turns the region near the corroding magnesium red.