A stock represents a means for companies to raise capital outside of a regular revenue stream. When companies sell shares of stock, they sell a small piece of ownership for interested investors to buy.
Shares of stock are priced based on supply and demand. Companies have a finite number of shares, and any investor wanting to buy stock has to decide if the price justifies a purchase.
With indirect ownership, investors acquire stocks through a slightly different means. The most common forms of doing so are mutual funds and exchange-traded funds.