People back stocks and shares like they bet on roulette numbers and sometimes they win, sometimes they lose. This is why some call it a casino, but the reality is different. Firstly, the outcome of a roulette wheel is random. The outcome of the stock market is not. It is influenced by many factors, including the state of world politics, investor psychology, actions of banks and governments, accidents of nature, human actions, and global economic trends, to name but a few. Skilled investors might read trends and work out which ones count, and calculate which stocks are likely to rise, which to fall. This is not true in a casino.
There is a more serious difference. The stock market helps to finance business and industry. When a firm issues stock, people buy it in the hope of gaining dividends from its profits, and of seeing the value of their investment increase as the company prospers. The shareholders are co-owners of the company, and their fate is bound in with its own. If it makes money, so do they. When people buy stock from others and drive up the price, they do so because they think it is or will be worth more than the share price suggests. When a firm's shares rise in this way, the nominal value of the company increases accordingly, and it becomes easier, and usually cheaper, for it to obtain finance for development and expansion.
The stock market resembles a town market, in that people are clamouring to buy and sell, and prices reflect the fact that some shares are popular and some less so. It thus sends signals about where investment is needed and where it can be most profitably applied. It tells people from moment to moment the state of the economy, and where they might usefully participate in it.