In order to understand this first, we need to understand the nature of atoms.
Atoms are the basic building blocks of matter.
Each atom has a nucleus that is made up of positively charged protons and uncharged neutrons. Since positive and negative particles attract, negatively charged electrons orbit the nucleus. This attraction is caused by a force called the electromagnetic force. In storm clouds, there are air currents that cause particles in the cloud such as dust and salt from the ocean to collide with each other. Sometimes these collisions result in the liberation of electrons.