Ok, lets just go over the basics. What an externality is is a cost or benefit from something a company or person does that they don't pay or get. There are negative externalities and positive externalities. A negative externality is a cost that a company foists on others, a positive externality is a benefit that the company gives others that it can't charge for. In short, externalities are the things that the market doesn't take account of.
An example of a negative externality would be a corporation that is manufacturing widgets. It has two options for how to make the widget. One process costs $10, but involves dumping waste in the lake. That waste causes $10 worth of damage to fishermen, property values around the lake and water treatment plant costs. So really it is costing $20 for every widget they make, even though the company only pays $10. The other option is a process where they could make it for $15, but not dump waste in the lake. Left to it's own devices, the company will just do the $10 process, but that is actually the less efficient way to make the widgets. So, government has to step in. It can either forbid dumping waste in the lake or it can make the company pay $10 per widget to pay for cleaning it up, which has the same effect.
A positive externality is, for example, a shipping company decides they need a lighthouse on a particular rock. That benefits all the other shipping companies too, but there is no way to make them chip in, so the company that builds the lighthouse is unable to recoup the whole benefit of their work.
Every economist alive, going all the way back to Adam Smith himself, has agreed that government needs to regulate externalities. Otherwise it is just inefficient. The market doesn't account for them in any way, so the market just acts like they don't exist.