The originating metaphor is of a "commons" (public pastureland) in a traditional village. Consider a pasture that can support 1250 sheep indefinitely, a population of 25 shepherds, and that each shepherd can graze and profit from 50 sheep indefinitely. By grazing one extra sheep, a shepherd can make 1/50th extra profit at a cost of only 1/1250. Thus each shepherd is tempted to "logically" keep adding sheep beyond the capacity of the commons to sustain them.
Modern equivalents are pollution of waterways, logging of forests, tossing of trash out of automobile windows. The contribution of each actor is minute, but summed over all actors, these actions degrade the resource.
The tragedy of the commons can be seen as collective prisoners dilemma. Individuals within a group have two options: cooperate with the group or defect from the group. Cooperation happens when individuals agree to protect common property to avoid the tragedy. By cooperating, every individual agrees not to seek more than their share. Defection happens when an individual realizes that it is in their interest to use more than their share of public property.
The antidote to the tragedy is enforcement of conservation measures by an authority, which may be an outside agency or selected by the resource users themselves, who agree to cooperate to conserve the resource.
References: