The biggest reason for the difference is that the gram of fat does not include the mass of oxygen needed to "burn" the fat to produce energy (or heat). On the other hand, explosives, like TNT, do not combine with atmospheric oxygen -- they are totally self contained. If they did need to use atmospheric oxygen, they would be burning (like a log) rather than exploding.
FatWhen a fat is burned to produce energy it combines with oxygen. There are many different kinds of fats, but one typical example of a chemical formula for fat (from on Wikipedia) is . So to burn this fat, you would need molecules from the air to get this reaction:
This means that 1 gram of this fat needs to be combined with 2.8 grams of atmospheric oxygen to burn (see) . Thus, the 9 Calories per gram of fat becomes only 2.3 Calories per gram of fat plus the oxygen needed to burn the fat - this brings us closer to the 1 Calorie per gram of TNT.
ExplosivesInstead of burning with atmospheric oxygen, explosives generate energy by decomposing. Basically a large-ish molecule with weak bonds between the atoms breaks up into small strongly bound molecules (plus atoms). The sum of the binding energy of these small molecules is much larger than the binding energy of the original molecule so that energy difference becomes kinetic energy of the small molecules. For example, TNT decomposes via one of these reactions:
The energy generated comes from the difference in energy of the chemical bonds in the TNT molecule versus the bonds of the small , and molecules.
So one goal, when designing an explosive, is to maximize this energy difference, however, that is not the only goal. Another goal is to have a stable explosive that doesn't decompose so easily that explodes while manufacturing the chemical or when transporting or handling the chemical. For example, nitroglycerin produces about 1.6 Calories per gram - much closer to the fat + oxygen value of 2.3 Calories (seeplus ). However nitroglycerin is extremely sensitive, and bumping into a beaker could cause it to explode. TNT is actually very difficult to explode and is thus safe to handle - it requires a blasting cap or something like that to cause the explosion. This is accomplished by making sure that the bonds of the large TNT molecule are stronger than the bonds of the nitroglycerin molecule so that it takes a significant input of energy to begin the explosion process. These stronger initial bonds will obviously reduce the explosive energy yield per gram.