Investing in stocks != gambling. The market is not a casino.
Which isn't exactly wrong - if you're a retail investor who isn't using satellite footage of parking lots, picking individual stocks is closer to gambling.
Investing in the aggregate is less gambling.
Investing in the stock market as a whole is just betting the game will be played.
With individual stocks, you are just betting on horses.
With hedging, you are betting on economic sectors (which can be as large as the whole world economic system) growing infinitely.
And regarding systems growing infinitely in limited environments, I have some bad news for you. Some would call them cancerous.