AIG "insured" debts it did not have enough holdings to back up. I quote the word insured because, insurance is barely what it used to be.
Traditionally, government demanded insurers have low-risk holdings to back up a sizable percent of their outstanding obligations. The regulations that handled this have been dismantled over the years. Additionally, the "insurance" has been broadened to include other type of investment vehicles instead of traditional insurance. AIG got greedy and was able to do so because they and others lobbied hard to allow them to be greedy. This was a multi-decade process.