Batteries store energy which can be recovered as electricity. They store energy in the form of chemicals.
Some chemical reactions cause a voltage to appear between the two substances that are reacting.
This is usually shown in the school lab with two metal plates like copper and zinc or a carbon rod stuck into a lemon, though it works with any fruit and most vegetables too. That voltage is what drives the current round some circuit connected between the two different metals. Once all the chemicals have reacted the battery can no longer make the voltage, it has 'run out'. What's more it takes a lot of effort for the current to get through some of the chemicals so not much current can be driven round the circuit. With AC from a generator both these problems disappear.