Stock Market is where stock in companies is traded.
When a company wants to raise money, one way is to sell stock - shares in that company. For instance if you buy 1 share of Apple, you now own a teeny-tiny piece of that company. Hopefully the company will do well, the price of its stock goes up, and you can sell your share for a profit.
Companies generally release millions of shares so it's not as though 1 share = 1% of the company. As people buy these shares, the money initially goes to the company which can then use it to expand (hire more workers, build more factories, etc. etc.)
As an investor, it is possible for you to pick and choose individual stocks, buying and selling as the prices go up and down. However this is generally pretty time consuming so the general advice is to look for other types of investments such as mutual funds or other things. However, most of these still rely on the buying, holding, and selling of shares of stock belonging to various companies.