Investing in individual stocks (what you call "gambling") is more risky than investing in S&P 500 but that's the trade off. More risk leads to more reward (or more loss).
If you invest in AAPL (or AMZN or GOOG or FB or NFLX) at the right time, you will 10x your money in under 10 years.
Is investing in any of those companies "gambling"?
And sure, you can also loose money, but "data from the BLS shows that approximately 20% of new businesses fail during the first two years of being open" so you can also loose money opening a business and yet we're not name calling people who open restaurants "gamblers".