Fireworks release heat when they explode due to the rapid chemical reactions that occur during the combustion process. When a firework is ignited, the various chemical components within it burn and undergo exothermic reactions, which release energy in the form of heat and light.
These reactions involve the oxidation of fuels and oxidizers contained in the firework. Specifically, when the chemicals are ignited, they produce gases and an increase in temperature, leading to an expansion of these gases. This rapid expansion generates a pressure wave, resulting in the explosive effect that we see as a bright burst of light and sound.
Additionally, the heat produced contributes to the bright colors and effects of fireworks, as different chemical compositions emit different wavelengths of light when heated. Thus, the release of heat is a fundamental part of the chemical processes that give fireworks their dazzling displays.