The way in which this works is analogous to a battery acting in reverse. The item to be coated is placed into a container containing a solution of one or more metal salts. The item is connected to an electrical circuit. The item may form the anode or the cathode of the circuit. When an electrical current is passed through the circuit, the electrons passing through the solution cause a chemical reaction. The metal is reduced to its ground state, and is thus the pure metal, and not a metal compound. This metal will deposit on the item, covering it in a layer of that metal.
Richard Feynman, described in his first memoir, his experiences in an early job developing technology for electroplating metal onto plastics in response to commercial promises his employer had made but otherwise couldn't have fulfilled.
See also: gilding