A lot of capital was looking for a place to get parked. AI and hardware seems like it has the best prospects going forward - especially with baby-boomers retiring and the new generation getting less opportunity to climb the economic ladder (aka catering to them is not attractive to investors).
AI is attractive to governments similar to any tech capable of war, so the race for offer capacity would give tech giants massive capital from lucrative government contracts that then gets into the flywheel of model training and selling to the masses.
The problem was they built data centers in a sloppy, dirty, loud way. Imagine if the first cars were like that? Or the first electric distribution methods? Do it right if you want to grow it.