Your Mac will be working very hard if you're using computationally demanding programs, like HD video editors or top-tier games. This produces heat. The fans will start spinning up as soon as the fan sensor detects an increase in temperature to prevent the system from roasting itself to oblivion