As a lawyer, not a transactional lawyer so this is pretty far outside my expertise, I'd imagine they'd include some provisions for this type of scenario in the agreement. Even if it didn't, the stadiums owners would probably offer FTX some sort of partial refund to give up the naming rights, which they would have to to pay back their creditors. They could even just breach the agreement and offer a settlement.
Eron field got renamed pretty fast. So will this stadium.
The Heat will find another partner, and they may or may not try to get money out of the FTX bankruptcy proceedings, but I'm guessing the odds of that aren't super high. Probably more efficient to cut bait and move on.
In a way it would be another asset for the bankruptcy liquidator to disperse.
I just looked up a similar situation from 20 years ago[0,1].
[0] https://www.nytimes.com/2002/02/28/sports/baseball-astros-ba...
All of this is handled much differently if a party is in bankruptcy (which is the point of bankruptcy).
Edit: here's [0][1] some sources that says FTX ponied up $135M for the name to remain through 2040. Your question still stands, will that name stay even if the organization that has the name doesn't exist or is circling the drain? All depends on the terms of the contract, I guess.
[0] https://www.local10.com/news/local/2021/03/27/nba-still-need...
[1] https://www.cbsnews.com/miami/news/its-official-miami-heat-h...