The stock market is a market in which companies are for sale. Now this might sound weird at first but in technical terms, each company that is "up for sale" offers shares as forms of ownership. Investors buy these shares and the companies use this money for their operations in exchange for giving the investor a certain amount of ownership. When the company is doing well, the share price becomes more expensive. This is also why some people might invest in start-ups in a vision that the company will do good in the future so that they can sell their ownership for a profit. Anyone, even you, can buy and sell shares of a company in an open market. People can do this through a brokerage, which is a platform where stocks are bought and sold. Examples of brokerages are Robinhood, Webull, and TDAmeritrade
Click here to read more about the stock market