Underneath the surface of our sun there is a current of hot plasma that creates electrically charge ion and electron. These electrical current flows and creates magnetic fields. These magnetic fields are all around the sun. Some of these fields creates loop that finally snap and explode. This magnetic loop can reach 44 million degree celsius. Sometimes an exploding solar flare triggers a chain reaction of many solar flares. It shoots out billion tons of sub atomic particles into the cosmos. It is called coronal mass ejection (CME).
These particles ejected by coronal mass ejection (CME) travel 8 km /hour. When these charged particles bombarded our Earth, it compresses Earth's magnetosphere which protects us from devastating effect of this bombardment. But that's not the end. When magnetosphere returns to its original position it releases billion watts of electricity. This can destroy our electrical equipment and communication system creating chaos in Earth.