How does the dynamite explode when shooting it?

Yes and no. Before dynamite was invented we used blackpowder for comercial explosives. Less volatile than nitroglycerin, but also useless if wet. And very heavy to transport.

Dynamite offered a better explosive in a smaller package, with the minor drawback that you could blow up a traincar if the stick so much as moved a little in transit.

He packed the dynamite with diatomaceous earth (fossilized algae) which helped mitigate that unless the blast cap was popped (by lighting the fuse) or put under immense pressure (like say, a gunshot).

More info than you bargained for, huh?

Also fun fact, apparently the word: jig gle is banned on the forums?