When two metals touch each other and water is present, electrolysis occurs. One well known example is the reaction between zinc (Zn) and iron (Fe). Zinc atoms will lose electrons in preference to the iron as they are more electropositive and therefore zinc is oxidized and corrodes.
Zn(s)→(aq) +2e (oxidation)