In electrolysis the ions carry the current through the electrolyte, while electrons carry it through the wires. Positive ions move to the cathode and gain electrons. This is called reduction. Negative ions move to the anode and lose electrons. This is called oxidation. The number of electrons lost at the anode equals the number gained at the cathode.
A half equation shows what happens at one electrode and must balance in atoms and in charge. At the cathode: Na+ + e- → Na, so each sodium ion gains one electron and becomes a sodium atom. Also Cu2+ + 2e- → Cu, so a copper ion gains two electrons and becomes a copper atom, and in aqueous solutions 2H+ + 2e- → H2.
At the anode: 2Cl- → Cl2 + 2e-, because two chloride ions lose one electron each to form one chlorine molecule. Hydroxide ions form oxygen: 4OH- → O2 + 2H2O + 4e-. Adding the half equations, with the electrons equal, gives the full equation, for example 2NaCl → 2Na + Cl2.