What is Stock Market?
The stock market is a place where trading of companies stocks and those securities are being facilitated by the Stock Exchange. Using this exchange stock can be bought or sold or any of the companies publicly listed.
One stock is a smallest piece of a company which you can own while company raises money from the public. A company gets listed are registered through a process called IPO (Initial public offering).
It is a process used by a company to raise capital by giving up a piece of its ownership to public.
To know why company needs to go public: If a company borrows money from a bank it needs to repay its principal along with its interest which indeed create pressure and it can go bankrupt. This also creates liquidity issue when company is trying to repay its monthly interest. Debt model can seriously affect that daily date day to day businesses.
To increase the capital to scale up the company, most company would give up a part of ownership and raise money public.
Now you will be confused why public should help someone to fix their problem? Am I right? Here is the answer for you on how a company will pay back its borrowed money from stock market.
The company will be providing bonuses and stock splits from the profit made from the capital. Many companies provides dividend to the investors on a regular basis if they are not having debt issues and getting more profits. On top of it, valuation of a company increases as stock price increases creating an option for the one investor to liquidate their investment and sell their stack in the business.

Why you should invest in Stock market?
Investing in a good growth company will increase your wealth multiple times. People can invest in stock markets to fight inflation and can deal with going of cost of living.
Almost all the richest people on the planet create huge wealth and financial freedom compared by Investing in stock market or by going public with their company.
Comparing to other investment options available, stock market historically gives better returns on investment and also not to mention the risk of losing the value of Stock price can go to Zero as well.
Among other possible investment such as fixed income, real estate stock market investment can make your wealth to improve at a better rate of returns.

Is stock market safe?
Stock market is not a scam but obviously we have the risk of losing money when investing in a poor company. There is equal chances of losing your company to that of making money. If you are investing in ETF of your national stock exchange or good growth company. Overall returns will be more than real estate or fixed income. But timing the market will not be possible for any investor.
Stock market were monitored by sovereign regulators managed by every government. Regulators who violates the rules will be punishable under law.