Galvanic corrosion occurs when two dissimilar metals are in electrical contact in a corrosive environment, leading to the more anodic metal corroding faster than it would alone, while the cathodic metal is protected. This phenomenon is driven by the electrochemical potential difference between the metals, which causes a galvanic cell to form, accelerating corrosion processes.