Hairspray contains flammable propellant, beer kegs simply rupture violently from steam.
The propellant would not ignite until the can ruptured because there is no oxygen in the can for combustion while the can is sealed.
The can ruptured due to the Ideal Gas Law (PV = nRT), just like the keg.