All particles of basic elements or compounds have electrical charges, be they positive or negative. If two different materials have the very same electrical charge, nothing will happen. This is the principle that makes a dry cell battery work. Dry cells use carbon and another metal to generate an electrical current flow between the negatively charged carbon, and a highly charged metal. Electrolysis People generally do not understand this term, using it as a catch-all to describe any kind of corrosion below the waterline.
Electrolysis is simply the result of stray current, and nothing else.
Galvanism and electrolysis produce similar results, only they have different causes. Basically, there will be very little flow when two metals are mated together dry. But add water to the join and suddenly corrosion blossoms. That's because water is a conductor and becomes the facilitator of the current flow. This is why mating dissimilar metals is much less of a problem inside your house than it is on your boat.