Ouch Not seen one go bang for a long time. When you are charging them hydrogen gas is given off and normally vented, but if the vent is blocked if there isn't one you should remove the top caps, otherwise it pressurises the battery case and can go boom
Either a build up of gas whilst charging due to a blocked vent or an internal short circuit across one or more cells due to plates collapsing under the stress of high rate charging. I would suspect the latter given the two visible sets of plates are distorted.
At collage we put a big spanner across the terminals of a truck battery to show the stored energy it went bang and melted a hole in the ceiling tiles
Well it's in the engine bay so that's ventilated but as for the batteries, I assume that if they need vents the manufacturers have fitted vents already. I know they are both sealed for life ones, so none of the little screw caps that me and my Dad used to unscrew when he charged his battery in the old days.