Externalities are the unintended positive or negative consequences of an economic activity that affect parties not directly involved in the activity. They occur when the social costs or benefits of a transaction differ from the private costs or benefits, creating a divergence between private and social optimum.