Just to add one dimension that the very concise answers from @SteveS and @EnergyNumbers appear to me not to stress to the degree I feel it is important:
The moment we introduce the time-dimension, the concept of "self-interest" changes fundamentally: to joke a bit, we become altruists towards our future selves. And since depletion of common resources can only happen intertemporally, there is no point in discussing the matter in a static framework.
Then, the length of the time-horizon becomes important. If individuals have too-short a time-horizon, their behavior starts to resemble a "one-off" decision, and then the "tragedy of the commons" emerges. As the horizon becomes more long-term, individuals become willing to commit -for example, commit to accept the existence of custodians (see @EnergyNumbers answer), and thus restrict their own possible actions (due to the guardianship actions of the custodians).
This aspect once more makes the issue a matter of degree: how long-term is our time-horizon. One can see this theoretically also, even in a non-cooperative game-theoretic framework: if the "game" becomes a repeated game, then even famous frameworks like the Prisoner's Dilemma may obtain new solutions: here cooperation (in the abstract sense) can be sustained if the discount factor is not too high. Translation: if the importance we give to the future, for our own sake, is high enough.
If we factor-in other ways humans plant roots into the future (like having children, or the observed existence of various collective identities), we can start to understand why common property appears "surprisingly well-managed" -and not so surprisingly, after all.