A battery can change chemical energy to electricity by putting certain chemicals in contact with each other in a specific way. Electrons, which are small parts of an atoms, will travel from one kind of chemical to another under the right circumstances. When electrons flow, this makes an electrical current that can power something. What a battery does is put the right chemicals in the right relationships, and then puts a wall between them. Only when the two sides of a battery are connected by a wire or another conductor can the electrons flow.
Engineers think of batteries as a place to store electricity in a chemical form.
Batteries tend to expend their charge fairly quickly. DS1 can last from half an hour to three hours running purely on battery power before the batteries need to be recharged from the solar panels. These batteries are recharged thousands of times over the life of the spacecraft.