Its the nitrogen cycle, essentially bacteria builds up in your filter and substrate that eats ammonia, which grows and then converts to nitrite, then to nitrate- which is less harmful than the other two and allows for much less frequent changes.
Check that out.
I cycled my tank with the help of live plants- mostly anarchis which noms ammonia like a champ.
Your fish are what supply the ammonia after it is cycled. Unless you do a fish in cycle, you need to supply it with ammonia. I recommend not doing fish-in, its harder and takes longer.