Confusion between positive and negative terminals of a battery
Outside a battery, current flows from its positive terminal to its negative terminal. Inside the battery, to stop charge building up, the current must flow the rest of the way round, from the negative terminal to the positive terminal. Electrolysis is like a battery charging as the reactions are reversed from the discharging galvanic cell