The aerosol can is sealed, and under pressure. Place it on a heat source, and the gas inside expands. Upon expansion with no outlet, the vessel may explode.
Pressure cookers work on this principle, as food can be cooked at higher temperatures than
100
∘
C
. Pressure cookers have safety valves, that will operate if the internal pressure becomes too high.