With the share market we are believing some third parties for our profits whereas in gambling, we are relaying on our own skills to make profits. I do believe on my own capability for my fortunes than others.
In stock market, you can rely on professional fund managers to manage the money for you. But those manager on average will be worse off than the index track funds.
In gambling, only very few professional gamblers can make a living. Most of the gamblers can only have fun, not the money.