Lithium batteries typically explode because the electrolytes we use are highly flammable. It's actually entirely incidental to the amount of energy stored in the battery. A Li-ion battery with a different electrolyte material could have the same energy density, but a greatly reduced risk of fires and explosion.