Electrolysis refers to using energy and electricity to split apart an electrolyte solution, which is a solution that contains ions. In order to split water, the water must be made into an electrolyte which can be done by adding baking soda.
The bonds of molecules store energy so when these bonds are broken, energy is released. By using a battery, enough energy can be provided to allow the water molecules to split apart. Since batteries have two terminals, a positive terminal and a negative terminal, once the water connects to the terminals, energy can flow, splitting the water as a result.