Fireworks were invented in 7th century China. The Chinese people believed they would ward off evil spirits and bring happiness and good luck.
Nowadays fireworks are used all around the world to celebrate various events. In the United Kingdom they are traditionally used on Bonfire Night, the 5th of November, to celebrate the failed Gunpowder Plot of 1605.
Please see below video on how fireworks work.