Wikipedia’s overview as to what galvanic corrosion is comes in the form of the following:
Dissimilar metals and alloys have different electrode potentials and when two or more come into contact in an electrolyte a galvanic couple is set up. A galvanic couple can also be set up on a single metal or alloy due to the metal surface not being homogeneous or if the electrolyte varies in composition, forming a concentration cell.
The electrolyte provides a means for ion migration whereby metallic ions can move from the anode to the cathode. This leads to the anodic metal corroding more quickly than it otherwise would; the corrosion of the cathodic metal is retarded even to the point of stopping. The presence of electrolyte and a conducting path between the metals may cause corrosion where otherwise neither metal alone would have corroded.
In some cases, this reaction is intentionally encouraged. For example, low-cost household batteries typically contain carbon-zinc cells. As part of a closed circuit (the electron pathway), the zinc within the cell will corrode preferentially (the ion pathway). Another example is the cathodic protection of buried or submerged structures. In this example, sacrificial anodes work as part of a galvanic couple, promoting corrosion of the anode, rather than the protected subject metal.
But it’s well worth the admission price just to read about lasagna cells – when lasagna in stainless steel baking trays comes into contact with aluminium foil and eats holes in it as illustrated above.
Something you rarely see Gordon Ramsey having a kitchen nightmare about.
The Euro Inox pdf STAINLESS STEEL IN CONTACT WITH OTHER METALLIC MATERIALS tells you the where, why and how of galvanic corrosion including prevention. It’s also available in a number of languages, which are all available for you to download:
The Italian version may come in dreadfully handy for those of you worried about foil-eating pasta.