What we need is a a way to justify a biological specimen naturally creating nitrogen triiodide
Which, when I was in high school coating books with the stuff before tossing them onto tables, was lovingly known as contact explosives. It's an unstable compound that goes "boom!" with enough jostling around.
And the really cool thing about this is that it would easily justify why the fungi grow in caves — to avoid the wind, rain, hail, and even charging water buffaloes of nature that would make them go boom! before their prime.
Nitrogen is easy. It's in the air and the soil. But here on Earth, Iodine is uncommon in the soil and (I don't believe) doesn't exist in the air. However...
Fertilizing with iodine derivatives has been shown to aid in biomass production and increase the antioxidant levels in plants which provide drought and stress resistance. (Source)
Which is really useful since your fungi live in caves where there isn't regular rainfall, yes?
But, iodine is a bit of a problem for normal plant growth (as it's understood here on Earth), so you really don't want it in the soil. Cool!
I propose that your planet's bedrock is naturally rich in iodine. As that rock erodes into gravel and finally soil, the iodine is released and washed into the sea (making it both salt and iodine rich, but like Earth's oceans which are too salty (and in this case iodine-rich) for land-based plant life yet capable of supporting substantial life). But the bedrock, found conveniently in many caves, allows the fungi to naturally create nitrogen triiodide, a contact explosive.
The consequence is that your adventurers might not be able to eat seafood....