Would you mind adding where that additional value comes from, if not from the losses of other investors?
You asked this in a comment, but it seems to be the key to the confusion.
Corporations generate money (profits, paid as dividends) from sales. Sales trade products for money. The creation of the product creates value. A car is worth more than General Motors pays for its components and inputs, even including labor and overhead as inputs. That's what profit is: added value. The dividend is the return that the stock owner gets for owning the stock.
This can be a bit confusing in the sense that some stocks don't pay dividends. The theory is that the stock price is still based on the future dividends (or the liquidation price, which you could also consider a type of dividend). But the current price is mostly based on the likelihood that the stock price will increase rather than any expected dividends during ownership of the stock.
A comment calls out the example of Berkshire Hathaway. Berkshire Hathaway is a weird case. It operates more like a mutual fund than a company. As such, investors prefer that it reinvest its money rather than pay a dividend. If investors want money from it, they sell shares to other investors. But that still isn't really a zero sum game, as the stock increases in value over time.
There are other stocks that don't pay dividends. For example, Digital Equipment Corporation went through its entire existence without ever paying a dividend. It merged with Compaq, paying investors for owning the stock.
Overall, you can see this in that the stock market goes up on average. It might have a few losing years, but pick a long enough time frame, and the market will increase during it. If you sell a stock today, it's because you value the money more than the stock. If it goes up tomorrow, that's the buyer's good luck. If it goes down, the buyer's bad luck. But it shouldn't matter to you. You wanted money for something. You received the money.
The increase in the stock market overall is an increase in value. It is completely unrelated to trading losses. Over time, trading gains outweigh trading losses for investors as a group. Individual investors may depart from that, but the overall gain is added value.
If the only way to make gains in the stock market was for someone else to take a loss, then the stock market wouldn't be able to go up. To view it as a zero sum game, we have to ignore the stocks themselves. Then each transaction is a payment (loss) for one party and a receipt (gain) for the other. But the stocks themselves do have value other than what we pay for them. The net present value of of future payments (dividends, buyouts, etc.) has an intrinsic worth. It's a risky worth. Some stocks will turn out to be worthless, but on average the gains outweigh the losses.