The tragedy of the commons was an article published by Garrett Hardin in the journal Science in 1968. It describes a problem where many people with their own ideas can make something they all share worse, even if no one wants to. For example, even if no one wants to pollute water because that makes it unhealthy, it can still end up like that because so many want to use the water for their own reasons, like washing and throwing away rubbish. Each person thinks that their small bit of pollution of the water is too small to affect the quality of the water, but because there are many people the total effect ends up making the water too polluted for mostly anybody to use for drinking or even washing. This may occur in slums and other overcrowded places like refugee camps.
The idea was not Hardin's, but a person named William Forster Lloyd who wrote about it in 1833. In those days herders often grazed cows on common land. Lloyd pointed out that each cow added benefit to its owner but damaged the land overall for all herders by overgrazing.