The fan's job is to manage the inside temperature.
When you do very little with a laptop, the processor and other components generate little heat, so the fan doesn't have to run hard to keep things cool.
When you do intensive things like play games, rip video, or when Spotlight does the first index of your new notebook, it generates a lot more heat. The fan has to spin faster to keep things cool.
Typically, the faster the fan spins, the more audible it becomes.