Over what time period? If I told you that if you give me $100 now, I'll give you $300 in 10 years, that's a fairly good deal if you think I have a good chance of delivering on that or enough other income sources to squeeze if that investment goes sideways. It's the same idea here only in the billions of dollars as opposed to the hundreds.
Microsoft investors either put up with this same shit the last several dozen times the company stuck a lot of money into some dubious but potentially profitable proposition or they sold their shares to someone else who would. Some of it pans out and a lot of it doesn't. The tech industry is the sort of place where one winner more than covers dozens of losers.
All of these companies get filtered through a further layer of a market that treats them in the same way that they treat AI. Microsoft, Oracle, and any other company you can buy shares of are just an investment that may or may not pay off. Staring directly into it will drive you mad, but somehow it works better on average than anything else we've come up with. It's not just companies that believe that AI will pay off, but larger humanity as well, at least to a certain degree best measured by willingness to invest in the companies investing in AI.
If you think all of that is utterly wrong and stupid then you should start shorting the stocks of the companies investing in AI. If you're right, you'll make money from doing so. If you're wrong you'll lose money. Whether you care about making money or not, this is a useful exercise for you to reflect upon how much you really believe your own position. As a wise man once said, "Put your money where your mouth is."