Actually, Adam Smith meant that market forces will automatically channel self-interest toward socially desirable ends. It's a major selling point for  laissez-faire capitalism.

The theory is that if each consumer can choose freely what to buy and each producer can choose freely what to sell and how to produce it, the market will settle on a product distribution and prices that are beneficial to all. This is an idealized situation, expecting everyone to act honestly.

Consider Standard Oil under John D Rockefeller. Rockefeller would enter a market, undercut the prices of his competitors -- often selling at a loss -- to force them out of business (he also played nasty tricks with the distribution network). Then, when he had a monopoly in the area, jack up his prices to gouge the customers. It took the Sherman Antitrust Act to deal with this.

There are also other problems with laissez-faire, such as there being no actual incentive for a producer to not pollute or to clean up pollution.