I'm not an economist, but the fundamental issue is that we take the last price that something sold (like a stock) as the actual real price of all the stock of that company.
So if you were holding 100 shares of Nvidia stock which you bought in January 2024 for $50 each, you would think you had $5000 of stock at that time. Recently people have been trying to buy Nvidia stock and have pushed up the price to nearly $200. You look at that and think, "Wow! I have $20,000 now!". And as a small investor, sure, you could unload those 100 shares for close to $200 and take that profit.
The "real" value of a company is actually the net present value of all it's future income. But the future growth (or decline) of a company is uncertain, so people who buy stocks are betting on what they think the future income of the company will be. A lot of people are buying Nvidia because they think AI will produce so much future value that Nvidia will make enormous profits in the future. And some people are just buying Nvidia because of the logical fallacy that stocks that are increasing in value will continue increasing in value.
You don't actually have to believe that the future of AI is bright yourself. You can ride the price of the stock higher as long as lots and lots of other people believe AI will be huge in the future and Nvidia will be part of that.
But once evidence comes to light that AI isn't all it's cracked up to be, then people's perceptions of how much Nvidia might pay out in future profits can drop substantially. When that happens, lots of people who own Nvidia stock will want out, and fewer people will want to buy it, and the price will drop like a rock (maybe even back to that $50 level). That's just supply and demand.
Did any money go anywhere? No, it just got shuffled around. Some people won and some lost, but there's no more or less money in the system. What there is right now is the perception of having more money. If you think you have $20,000 in your investment, you think you have more money than if you have $5000 in your investment. And realistically, what you really have is 100 shared of Nvidia, and all the future profits that those 100 shares entitle you to.