Both are chemical changes as they are irreversible and chemical composition gets changed.
The formation of water is a combination reaction.
2 H2 + O2 ---- 2 H2O
The electrolysis of water to give hydrogen and oxygen is a decomposition reaction.
2 H2O ----- 2 H2 + O2