Why is nitroglycerin so unstable?
An explosion is a type of spontaneous chemical reaction that, once initiated, is driven by both a large exothermic change (great release of heat) and a large positive entropy change (great quantities of gases are released)   $\ce{^1}$ from  reactants to products (a thermodynamically favorable process).

The energetic stability of the gaseous products and hence their generation comes from the formation of strongly bonded species like carbon monoxide, carbon dioxide, and (di)nitrogen, which contain strong double and triple bonds having bond strengths of nearly 1 MJ/mole. 

Consequently, most commercial explosives are organic compounds containing $\ce{-NO2, -ONO2}$ and $\ce{-NHNO2}$ groups that, when detonated, release gases like the aforementioned (e.g., nitroglycerin, TNT, HMX, PETN, nitrocellulose).

In general, Detonation is used to describe an explosive phenomenon whereby the decomposition is propagated by an explosive shock wave traversing the explosive material at speeds greater than the speed of sound within the substance.

The following factors affect the stability of an explosive: (1) Chemical constitution.
(2) Temperature of storage. (3) Exposure to sunlight (4) Electrical discharge. 

Certain groups like nitro  (–NO2), nitrate (–ONO2), and azide (–N3), are intrinsically labile or Kinetically there exists a low activation barrier to the decomposition reaction which makes compounds exhibit high sensitivity to flame or mechanical shock. 

Nitroglycerin $\ce{^2}$ is a primary explosive  that is extremely sensitive to stimuli such as impact, friction, heat, static electricity, or electromagnetic radiation ultimately leading to detonation.





You can see that 4 moles of nitroglycerin produces 35 moles of hot gases.The concentrated gases are under very high pressure, so they expand rapidly. The heat speeds up the individual gas particles, boosting the pressure even higher. The gas expands faster than the speed of sound, it generates a powerful shock wave.

As a rule of thumb, explosives with an activation energy of decomposition
higher than 170 kJ/mol are stable for thousands of years at room temperature, whereas for values below 155 kJ/mol, chemical stability is limited.$\ce{^3}$

As can be seen from Table below $\ce{^4}$, the commonly used explosives from the classes of aromatic and aliphatic nitro compounds, secondary nitramines, and organic azides are very stable, whereas aliphatic nitrate esters suffer from much lower chemical stability.

 

TNT is a secondary explosive less sensitive than a primary explosive and requires substantially more energy to be initiated. 

2,4,6-trinitrotoluene (TNT) is a molecular explosive that exhibits chemical stability due to its high performance, comparatively low shock sensitivity, low melting temperature of TM = 353–354 K (80–81 °C)$\ce{^5}$ $\ce{^6}$

References


https://en.wikipedia.org/wiki/Explosive#Stability
http://www.ch.ic.ac.uk/rzepa/mim/environmental/html/nitroglyc_text.htm
Chimia 58 (2004) 401 -408 
https://www.ingentaconnect.com/content/scs/chimia/2004/00000058/00000006/art00010?crawler=true
M. L. Hobbs and M. J. Kaneshige, in Proceedings of the Society for Experimental Mechanics Annual Conference, Albuquerque, NM, 2009
APPLIED PHYSICS LETTERS 104, 021911 (2014) ,
" Chemical stability of molten 2,4,6-trinitrotoluene at high pressure "
Dana M. Dattelbaum, Raja S. Chellappa, Patrick R. Bowden,Joshua D. Coe,
and Madeline A. Margevicius