I buy two paintings by, let us say, Atticus Finch (extra credit for the first person to peg who he really is, by the way) for $15 at a yard sale.
Years go by. Atticus paints more, becomes well-known, has a few exhibitions, and then - I hit the jackpot. He dies.
The next year, I sell my first original Atticus for $100,000. Five years later, the market having gotten even more intense, I sell my second Atticus for $200,000.
Who “lost” the money that constitutes the difference between what I paid for the paintings and what I sold them for?
No one. The paintings simply became more valuable.
So, too, with stocks. Their rise in price simply indicates that they are more valuable; their fall that they are less so. No one is necessarily losing or gaining any money other than the owner of the stock.
It’s not a zero-sum situation. There is not x amount of money in the world. If I hand dough, blueberries, and spices to three different people, the first, untrained as a cook, may create nothing but an inedible mush. Value? Zero. The second may create a tasty blueberry pie, value $5 or so. The third, a chef of great talent, may create a blueberry tart of exquisite taste, value $30.
Where did the extra wealth come from? It was created, pure and simple.