Starting a business requires a lot of money. Especially if your company makes expensive products like cars. There is a limitation to which an individual can provide money for a company. One crore, two crores, ten crores etc. But beyond that one has to borrow money from friends, family, bank etc. and even they have limitations to which they can contribute.
Then how does a company raise a huge amount of money? (1000 crores, 2000 crores, 10,000 crores) They do that by taking a relatively small amount of money from a very large number of people.
For example, a company can raise 1000 crores by taking 500 Rs. from 20 million people. How can a company accomplish this? They can issue 20 million shares each priced 500 Rs. and raise 1000 crores in the process.
Companies generally prefer raising money by issuing shares instead of taking a loan from the bank which would require them to pay interest.
When you buy a share in a company, you are actually buying partial ownership in that company. Meaning you will make a profit when the company makes a profit and a loss when the company makes a loss.
That is why you should periodically check the profitability of a company when you buy a share in that company.