A defective or improperly-handled battery can overheat, causing the cells to break open and result in a chain reaction of other cells rupturing. This is called thermal runaway, and it’s the cause of most battery explosions and, less dramatically, battery swelling. The defect can be a simple short circuit, or a design defect that improperly insulates individual cells from the heat of neighbors. That’s what causes cell phones and laptops to catch fire on rare occasions.
Any Li-ion battery has the potential to go up in flames, and that’s a product of its chemistry. Lithium is used in batteries as an anode because it has extremely high electrochemical potential. That is, lithium-ion moving to the electrode produces a lot of energy. Lithium’s low atomic weight is also useful in reducing the mass of batteries.
Battery explosions aren’t as common but they do happen, however most of the time is caused by the end user. There’s a lot of “tips” on social media where daring people attempt to recharge their device by putting it in a microwave for a second. Hundreds if not thousands of people have tried this out of curiosity, to me that doesn’t sound like a very good idea but people do it anyway.