Usually, individuals seek to maximize their utility. When dealing with public goods, utility has a positive side and a negative side. The positive side for the individual is the gain that the individual gets for himself by using public resource. (It is important to understand that the problem would not arise if the resource were property, a "Coasian" solution.) The negative side for the individual is equal to the gain divided by the number of individuals in the community. Since the gains always overcome the losses, the best strategy for an individual is to try to exploit more than his or her share of public resources, and since every rational individual will follow that strategy, the public resource gets overexploited.
The originating metaphor is of a "common", which was not public land - the public at large had very limited rights, and only those locals who were also "commoners" had access to a bundle of rights; each commoner then had an interest in his or her own rights, but the common itself was not property, nor were the rights "property" since they could not be traded. In a traditional village these provided commoners with rights of grazing, gathering fuel wood non-destructively "by hook or by crook", etc. (the form "commons" is plural, and refers to the whole group of commons subject to these effects).
Consider an area used for grazing (among other purposes - it could be "Lammas Land", used for private crops in season) that can support 50 cattle indefinitely, a population of 25 peasant householders who keep cattle among a range of subsistence activities, and that each peasant can advantageously graze and profit from 2 cattle indefinitely. By grazing one extra cow, a peasant can make roughly 1/2 extra "profit" at a "cost" of only 1/50. However this was typically a subsistence activity, not a commercial one, so it is misleading to think in terms of "profit" and "cost"; keeping sheep would have been a more commercial activity, not typical of peasant life then. Thus each peasant is logically tempted to keep adding cattle beyond the capacity of the common to sustain them all optimally. In this example, the carrying capacity and potential yield of the land were not destroyed.
However, the metaphor is not an accurate description of how the system worked during most of its history, although it serves here for purposes of illustration. Historically, no single common was ever truly public but was reserved for its own commoners, whose own use was also restricted in various customary ways (which differed from place to place). The system indeed began to behave in the ways described, but that was not its standard mode of operation but rather a late response to internal and external stresses, e.g. from demographic and cultural shifts.
Modern equivalents are pollution of waterways, logging of forests, tossing of trash out of automobile windows, and e-mail spamming. 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 a collective prisoner's dilemma. Individuals within a group have two options: cooperate with the group or defect from the group. Cooperation happens when individuals agree to protect a common resource 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 resource.
One of the leading problems of political philosophy is to articulate a solution to the tragedy of the commons. Typically, a solution involves 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. Another commonly proposed solution is to convert each common into private property, giving the owner of each an incentive to enforce its sustainability. Effectively, this is what took place in the English "Enclosure of the Commons"; this case highlights the effects of hidden wealth transfer in privatization, if no or inadequate matching compensation occurs.