

A battery is actually an electrochemical cell. It has electrodes which can produce ions in the electrolytic mixture that they are dipped in. So the reaction inside a battery happens in such a way that at one electrode more ions will be produced than at the other electrode. In this way, a potential difference will develop which is maintained constantly in a circuit.
