Whirlpooling causes the solids in the wort to collect in the center of the brew kettle so that less trub/hop particles make their way into the fermentor when you transfer via ball valve or siphon. You stir the wort to create and whirlpool and wait 20-30 minutes for everything to settle out before the transfer.
Adding hops at this time is done to retain more of their essential oils (aromas) compared to a boil addition. As long as the temperature of the wort remains above 185 degrees or so, you'll also continue to isomerize alpha acids, meaning the bitterness of the beer increases. Unfortunately, the formulas for calculating bitterness do not take post-boil isomerization into account. Some people get around this by simply adjusting the timing of the additions in their brewing software. For example, if you boil for 60 minutes and whirlpool/rest for 20 before chilling, your 60' boil addition is treated like a 70 or 80 minute addition in the software. Your flameout/whirlpool addition then becomes a 10 to 20 minute addition.