Oxygen Exahustion
Fish may live under water but they still "breathe" oxygen and release carbon dioxide. The oxygen fish breathe is dissolved oxygen. They do not derive oxygen by splitting the hydrogen and oxygen which make up water. For this reason oxygen in water is very much a finite resource. In open ecosystems such as rivers or lakes the water mixes, bringing fresh water containing more oxygen and taking away carbon dioxide. An aquarium is not a completely closed system in that the surface water interacts with the air and new oxygen gets dissolved, a process assisted by pumping bubbles through the water. However without this pumping and without natural mixing the fish can exhaust the oxygen supply, making it hard to breathe.
Microorganism
Feces and waste food will also build up in closed ecosystems. This provides food for microorganisms such as bacteria which can quickly accumulate when not dispersed by currents or filtering. Just like the fish, microorganisms use up oxygen and produce carbon dioxide when they respire. Sufficient numbers of these microorganisms can use up sufficient oxygen to pose a problem for fish.
Ammonia and Nitrite
The breakdown of proteins by bacteria and in the fish's metabolism makes ammonia which dissolves in the water. Some bacteria can also break ammonia down into nitrites. These compounds are extremely poisonous to fish because they cause inflation of sensitive tissues such as the gills. This causes the gills to swell and so makes it difficult for the fish to breathe. In an open ecosystem, protein levels would not build up in one place sufficiently for ammonia to become an issue, but in a closed system there is nowhere for these compounds to escape to.
Infection
Due to the build up of waste matter and the lack of fresh water, fish in tightly sealed environments are very susceptible to bacterial diseases, fungal infection and increased numbers of parasites. This can damage their gills and cause difficulty in breathing. In particular, these pathogens cause inflammation of the gill, which lowers the surface area of the gill. This makes obtaining oxygen by diffusion from the water more difficult.