It is most likely an accident. Not really even a freak accident. Fertilizer is very volatile due to it being nitrogen-fixed, and nitrogen's high-energy bond makes it the reactant in most known explosives. A whole factory of it would easily go up in flames and explode.
You'd be surprised about the volatility of a lot of stuff. There are videos out there of people igniting weed killer by jumping on it.
If nobody else said, you can get an explosion in a
custard powder factory. Loose and/or airborne powders can be bad just by being nominally flammable.
Of course, strained nitrogen bonds[1] don't tend to help.
Coincidentally, the other day the XKCD What-If page on pressure cookers led me on a merry web-walk to
this archive page. Which made interesting reading. (And, in the current uppermost item, viewing.)
"If small pieces of yellow phosphorus be added, with stirring, to a solution of chlorine azide in carbon tetrachloride at 0C, the solution gradually becomes turbid, and a succession of slight explosions takes place beneath the liquid. If stirring be omitted until the maximum turbidity is attained, the slightest agitation results in a detonation that demolishes the apparatus. . ."
...and that's one of the tamer compounds mentioned. Need to turn down the small laser in your spectrometers, anyone?
[1] Point taken, from a later post, about energies needed to make and break bonds. But on a per-bond basis those energies needed to overcome the maintenance of the bonds are small compared to the energies that can be applied by agitation, heating, adding a catalysing molecule and/or supplying non-neutral mid-products with an active radical site ready to take over from the original bonding configuration. And when the new formulation of bonds created are less arduous to construct than the original you've got some spare energy left over which often
somehow finds its way performing a similar resculpturing process on adjacent molecules. And, yes, a large genesis of molecular nitrogen (by way of Boyle, Gay-Lussac and Charles), gives you an explosion as opposed to a mere exothermic disintegration, and can happen with even unstrained nitrogen bonds flipping into N
2 along with the generation of various other gaseous oxides. (And I know I'm missing the mark in this explanation. Just edited down the footnote by half, leaving out some interesting stuff and probably introduced misunderstandings or errors along the way during the contraction process.)