A battery generates electrical energy through internal chemical reactions. It consists of a positive terminal, a negative terminal, and an electrolyte that separates the two poles.
When the battery is connected to a device, electrical current flows from the negative terminal to the positive terminal through the device, allowing it to operate.
During this process, chemical energy inside the battery is converted into electrical energy.