What makes a stock valuable? In the olden days, the way stocks worked was that you gave some money to a corporation, which used the money to build a railroad and paid you a dividend as your reward. Maybe if times were good, the dividend would go up, and if times were bad, it would get cut, but if you bought the blue-chip stocks of good steam railroads, you expected to get your dividend. And then you could apply some straightforward math to figure out the present value of that perpetual stream of dividends, and that’s what you’d pay for the stock.
Then some companies thought, well, instead of paying this money out to shareholders, we could invest it in laying more new track and expanding our railroad empire, which will in the future allow us to pay even greater dividends to shareholders. This was actually a controversial idea back in the olden days! But it worked very well, to the point that now it would be quite weird for a fast-growing tech company to pay a dividend when it went public. Now the point of corporate profits is mostly to make the corporation bigger.