Nitrate is generally the end product of ammonia breakdown (Generally being the main word, more on this further down).
Certain bacteria utilize ammonia and in doing so break it down into nitrite. Both ammonia and nitrite are poisonous to fish in small quantities. Bacteria further breaks the nitrite into nitrate, still harmless but far less so.
There is also a fourth level to this process, more commonly seen in marine tanks, especially those using a deep sand bed. The flow of water through a deep sand bed is very slow, thus the level of oxygen is less the deeper the bed goes. In the lower levels, the bacteria has no oxygen so must rely on other means of fuel, namedly the three substances mentioned above. They utilize these materials and further break it down into nitrogen which, in it's gaseous state, floats through the water column to be expelled into the air.
That is a brief outline on the subject, I could go on, but I don't want your eyes to fog over lol It should, however, be enough to give you a fair understanding as to the principles behind why maturing a tank is so important before adding livestock. Without the bacteria your fish will either die or be severely weakened from ammonia poisoning.