During electrolysis of water, why does hydrogen collect on cathode

During electrolysis of water, why does hydrogen collect on cathode and oxygen collect on anode ?
A. When electric current is passed in water hydrogen ions (H+) move towards cathode and get collected over it. Hydroxyl ions (OH )move towards the anode and oxygen is collected on it.