There are many ways to use the financial markets that are not gambling. Buying an index fund or Coca-Cola isn’t gambling; it is not even very risky. Nor are individual stocks gambling, as you can get a reasonable idea of what a company’s price ought to be and how it is likely to perform in the future, at least for well-established companies. It’s also harder to get into debt, as long as you don’t short, because you can only spend money you have, and the stock does not become worthless if your analysis is wrong. (At least, there are warning signs)
Now day-trading? I consider that gambling, because any particular day’s price movement is a lot closer to random.