Investment:
Corporations are all about spending other people's money (to try and make more money). Say you want to do something like start a business, do you have the money needed to start it up? Can you afford to buy or rent an office/warehouse, pay utility bills, purchase supplies from suppliers, pay employees and all the tons of legit costs of running a business? Probably not, or at least not all by yourself.
You need an investor(s). There are two ways to invest in something, credit (a loan) and equity (stocks). You know basically what a loan is. Stocks are an alternative that instead of an interest rate give a stake in the business for good or bad. Stocks are by definition a gamble on how well someone else can run a business and how things that aren't that person's fault will turn out for the company (part of it is luck and anyone who denies that is living in the proof right now: this economy). The thing about a loan is you get paid if the business fails, because you can sue, foreclosure, etc and you get paid before stockholders if there's anything left in bankruptcy. Stockholders are the last vulture at the corpse in bankruptcy at the bottom of the pecking order. They often lose it all if the company goes bust.
So, investing in a business through stocks is risky as hell. Having a stock market helps people manage those risks in concrete ways, a.) limiting exposure to only what you want, b.) having a bunch of other people to sell out to if you wanna bail on the investment.
a.) You can buy a single share of stock, a thousand or any amount. Maybe someone doesn't have the ability to or isn't willing to invest $10,000, but they might do $5,000, or $1000, or $100. "No one has a dollar, everyone has a quarter," means you can have a wider variety of smaller investors and bring them together to fund your business. Without a stock market, how're you gonna ask for lots of individual investors of $100 a pop? What if there are 1000 of these people out there and that could raise your business $100,000? See how that's an advantage.
b.) investors being able to sell out is pretty self explanatory. If you can sell the stock, then you can get your money back, or at least the money the stock is worth when you sell. If you couldn't sell the stock easily, then you'd be stuck with some stupid piece of paper giving you a very small ownership stake in a company you don't want that your money is tied up in. <---- This makes people less willing to invest in the first place (not being able to sell out).
As for the automation bots who buy/sell automatically when the shares reach a certain point, I disagree with that. They are supposed to be a way to limit risk. If the computer automatically sells out shares in X company when they go below Y amount, that means you theoretically won't loose Y amount and will at least keep that no matter what. The counterargument against me is, "wouldn't human traders do the same thing, "sell off their stocks at a certain point?" The answer is yes, but I maintain a human being can see things a machine can't. At least some of them.