The first thing to understand about stocks is what they are. In simple words, a stock are pieces of ownership of a business.
If you buy shares in Infosys stock, you are buying a tiny part Infosys.
It's important to understand that stocks are not ticker symbols that move up and down making profits and losses for traders. They are real businesses.
When you invest in a stock, you become a part owner of the business as a shareholder. You receive a share of the profits i.e. dividends. You also profit from the rising share price in the stock market.
If the company you've invested in goes bankrupt, as a common shareholder, you will be the last in line to receive any compensation from the bankruptcy proceedings.
That is the risk, along with the risk of share price volatility, you take on when investing in stocks.
On the positive side, if the company you've invested in does well over time, you will be rewarded with a soaring share price along with handsome dividends.
If the company grows strongly and consistently, you may end up with a multibagger stock. These are stocks that rise many times in price thus multiplying your original investment.
This is the main reason why people invest in stocks. In the case of fundamentally strong companies, the potential returns on investment far outweigh the potential risks.