When two different metals are in contact in the presence of an electrolyte (like water containing dissolved salts), a galvanic cell is set up. The metal with a lower reduction potential (more reactive) acts as the anode, and the metal with a higher reduction potential (less reactive) acts as the cathode.