The stock market is the place where stocks and bonds are traded. Stocks are units of ownership in a company, and so they can sell their stock to get money.
As an investor, when you buy stock you become a shareholder which means technically you own a part of the company. If the profits of the company increase, you, as a shareholder receive a portion of those profits.
Not all investments in stock are successful, stock prices rise and fall regularly and getting a return on your money is never guaranteed, part of investing means you take a risk on a company.