Hydrogen gas produced from charging was ignited by a spark.Not that uncommon.
Worked on cars for many years. Learned this , luckily, the easy way. I was attaching jumper cables to a car to jump start it , small spark and crackel as the final connection was made. Then I noticed a few tiny sparks in the air near the battery caps. What I did not know at the time , there was a small fire I had ignited by making the last connection. A completely colorless flame almost invisible except for the few tiny random sparks in the flames. I backed up , was unsure of what was going on. Then the top of the battery exploded just like in the OP's picture. Luckily I had backed up , I didn't get hurt or any acid on me. Older batteries still have vent caps to allow excess gases like hydrogen escape. It also has a bit of a flame arrestor too , but may not work perfectly. Smaller batteries like for lawn tractors and such use older technologies to save costs.
Lesson learned , always connect the last connection with jumper cables to ground away from the battery like the engine block or a big piece of metal not the terminal of the battery. If it creates a spark like it does a lot , it is away from the gases exiting the battery.
In this case (OP's battery) it could be caused by a loose connection that upon putting power to the circuit , like starting the engine , all you need is a tiny , tiny spark and kaboom. Hydrogen is very , very quick to ignite.