It's simply allowing the bacteria to grow. The problem with the bacteria is that the ammonia->nitrite->nitrate produces very little energy for the bacteria to use. Because of this they grow very slowly, taking days of time to go through a generation compared to the 20 minutes or so of say a bacteria such as e. coli.
Cycling time will vary, generally you can expect it to take about a month plus or minus a couple of weeks depending on water parameters, and a bit of luck. Having seeded media can greatly reduce this amount of time.
It's important to cycle the tank, you want to establish enough bacteria in your tank so that they can consume the ammonia and nitrite faster than your fish can create it.
Sent from my HTC6515LVW using Tapatalk