As batteries come in a variety of chemicals, we will talk about alkaline batteries:
- Batteries discharge (whether in a device or not)
- The discharge causes an increase of hydrogen [gas]
- The increased-pressure eventually causes a rupture
- The potassium hydroxide (the part that holds the charge) leaks and interacts with the carbon dioxide in the air
- Potassium carbonate is produced and builds-up on the end.
Apparently, the buildup tends to happen on the negative end due to the positive end being sealed differently.
Alkaline batteries are called alkaline because they are just as alkaline as hydrochloric acid is acidic (the opposite of alkaline). So, they are very, very alkaline.
(Battery Corrosion, Why They Leak And How To Prevent It)
(Alkaline battery)