The nitrogen cycle is the natural processes that go on in your tank that convert ammonia into less harmful substances.
Ammonia gets into your tank through various pathways. Fish waste, decaying uneaten food, and dead, decaying plants are common ammonia sources in an aquarium. Its also possible your tap water is an ammonia source. Chloramine is a common water treatment and when treated with most water conditioners the bond in the chloramine breaks and releases ammonia into the water.
Ammonia can be toxic to fish, depending on how much there is, and what the pH and temperature of your tank water is.
The first stage of the nitrogen cycle is the removal of ammonia. If you have real plants in your tank some of this ammonia will be absorbed as part of their natural growth. Generally though ammonia is consumed by denitrifying bacteria that lives mostly on your filter media. These bacteria consume the ammonia and produce nitrite. Unfortunately nitrite is pretty much as toxic to fish as ammonia.
The second stage of the nitrogen cycle is the removal of nitrite. A different denitrifying bacteria will consume the nitrite and produce nitrate. Nitrate is much less harmful than ammonia and nitrite, and for most aquariums the nitrogen cycle ends there. Excess nitrate is removed through your regular water changes.
A further stage of the nitrogen cycle can also happen, but its difficult to remove all the nitrate from a typical freshwater aquarium. Plants will absorb some nitrate in a similar manner to how it absorbs ammonia to grow. There are also nitrifying bacteria that consumes nitrate and gives off nitrogen gas which will simply offgas from your aquarium. This nitrifying bacteria is difficult to grow in freshwater aquarium.
“Cycling” a tank is the process you go through to grow denitrifying bacteria in your aquarium to consume ammonia and nitrite. You are said to be “cycled” when you have enough bacteria to consume all the ammonia and nitrite that your tank produces and turns all of it into nitrate. If you test the water of a cycled tank you should see 0 ammonia and nitrite and some nitrate.