Why Does Electrical Work Cause Changes in Internal Energy of the System?
If water is electrolyzed producing $\ce{H2}$ and $\ce{O2}$ gases, a great amount of energy has to be added to this water. The obtained substances are not hotter than the original water. But they possess a much higher potential energy. Their internal energy (and enthalpy, and free enthalpy) is much higher than the same atoms in water. This internal energy may be liberated into heat if these substances are sent in a flame, or into electric energy in a combustion cell.
It is no use thinking about the work done by an electric field on an electron in the atoms. The electric field inside an atom is difficult to calculate, because of all other electrons interfering with the field of the nucleus inside the atom.