The electrodes have different charges. One is positive ( the cathode ) while one is negative (anode). They will attract the particles in the solution which are charged. Hydrogen to the cathode while oxygen will go to the anode.
I have been taught that water is a covalent bond. Also I have been taught that covalent bonds do no have a charge so how is it possible that this compound is charged if it's covalent?