Explosives require the mixture of a fuel and an oxidant. These can be in separate molecules, as in gunpowder (charcoal and sulphur fuel, potassium nitrate oxidizer) or in the same molecule, where molecules containing -OH groups (such as glycerine or cellulose) are nitrated to nitroglycerine and nitrocellulose. Toluene, a hydrocarbon, has a particular structure that allows it to be nitrated to TNT. Industrially, these reactions proceed using nitric acid and generate water as a byproduct. Sulphuric acid serves both as a catalyst and a water scavenger.
I'm not aware of any biological process mimicking this. The best natural sources of nitrate come from -NH2 containing waste such as bat droppings, which naturally convert to -NO3 in the presence of atmospheric oxygen over a relatively long timescale. The nitrogen rich waste is toxic, so the chances of an organism being able to hold concentrate it and hold onto it long enough to turn into nitrate (which can be even more toxic) are relatively low. Plants often struggle to find enough nitrogen. Animals lose the carbon they get from food through respiration, and have to excrete nitrogen in the form of waste.
There are, however, many biological systems that generate hydrogen peroxide. This is an intermediate step in respiration of atmospheric oxygen. The decomposition of hydrogen peroxide to water and oxygen 2 H2O2 --> 2 H2O + O2 is quite exothermic and can generate a pressure explosion. This reaction, accelerated by a catalyst (such as permanganate, blood, iodide, or yeast) is the basis of the "elephant's toothpaste" experiment of which numerous examples can be found on youtube. It has been used as a monopropellant in rockets and torpedoes, and premature decomposition of hydrogen peroxide in an enclosed space has caused accidental pressure explosions (incidentally, excessive pressure of carbon dioxide produced in alcohol fermentation has also caused pressure explosions.)
The power of hydrogen peroxide is much enhanced when it is used to oxidise a fuel source (and bipropellants consisting of hydrogen peroxide and a fuel source are excellent rocket fuel.) A fairly tranquil example of the use of hydrogen peroxide as a fuel source is in certain light-producing chemical reactions. It has been suggested that bioluminescence evolved from antioxidants which originally protected organisms from the toxic effects of hydrogen peroxide. https://en.wikipedia.org/wiki/Bioluminescence
A more dramatic use of hydrogen peroxide is in the bombardier beetle, which uses the oxidation of hydroquinones by hydrogen peroxide to attack predators. https://en.wikipedia.org/wiki/Bombardier_beetle
The oxidation of alcohols by air is a safety concern in laboratories, as it can lead to explosive organic peroxides. It's possible that a biological system could produce an organic peroxide which, after drying, could be quite a powerful explosive.
Acetone peroxide has been used as an improvised explosive in terrorist devices https://en.wikipedia.org/wiki/Acetone_peroxide as it is very easy to prepare from acetone and hydrogen peroxide. Acetone is produced in small quantities in biological systems. Compounds similar to acetone can also be made from degradation of alcohols, which are rather more common in biological systems (conveniently enough, degradation is by oxidation, which converts the C-OH group into a C=O group, known as a carbonyl, with the double bond then naturally reacting with substances such as other alcohols, carbonyls or hydrogen peroxide to form rings.)
TLDR: Peroxides, while less potent than nitrates, are more likely to arise naturally within an organism, already have several biological uses, and could produce a powerful explosive.