Modern CPUs use CMOS (or more recently FinFET) process technology, which is designed to allow the CPU's transistors consume very little power except while switching state. When a CPU is executing an idle loop many less transistors need to change state than when its performing "heavy calculations". Absent of any specific power saving technology a modern CPU will use less power when idle.
However there are a number of technologies CPUs can use to reduce power consumption even more. Most of them are built around one instruction that almost all CPUs have, the halt instruction.
Halting the Idle loop
Most operating systems actually have an idle loop that looks more like this:
while(true):
halt()
Where halt()
executes a halt instruction. This instruction causes the CPU do nothing until it receives an interrupt. When it does it process that interrupt normally and continues normal execution. While it's executing this instruction, waiting for an interrupt, the CPU is doing very little internally, there's no need to even advance the program counter (instruction pointer), so there's very few transistors changing state reducing power consumption.
An idle loop like this works because the operating system schedules it like a normal processes. When the OS has no processes that need to execute it executes the idle loop instead. The idle loop, or idle task, becomes the absolute lowest priority task. When a hardware device indicates that an operation is complete through an interrupt, another processor sends an interprocessor interrupt indicating that this processor has something to do, or a timer interrupt occurs, the operating scheduler gets a chance to see if a regular process now needs the CPU.
Low power halt states
Additional power saving technologies can be used to reduce power even further when executing the halt instruction. The voltage CPU uses can be reduced. The CPU can can stop its clock to to reduce the transistor state changes that need to occur while waiting. Parts of CPU can be powered down so that even the small amount of power that their transistors use when idle isn't consumed. There can be cost to these using these low power modes, like increased delay when resuming normal execution or reduced interrupt sources capable of ending the wait, so they're not necessary used all of the time when idle.
On low-power embedded CPUs this can reduce the current consumed to a couple hundred nano-amps, which can be less than the self-discharge rate of the batteries used to power these devices. That is, the battery will lose more power sitting on a shelf than these CPUs would consume in the same amount of time when in their lowest power halt states. General purpose processors like x86 CPUs and even the advanced ARM CPUs that power smartphones can't get any near these infinitesimal power numbers, but they can reduce their power consumption a lot when idle compared to their full power states.
Other power saving technologies
There's other power saving technologies that CPUs can use that don't involve the halt instruction, like lowering their clock rates when there isn't much work to do. A related technology is "turbo boosting", that is increasing the clock of rate of one or more CPU cores, but aside from not saving power, in practice this is a more technique of rebalancing the power consumption (and thus heat production) between multiple CPU cores. One or more CPU cores have their clock frequency increased, using more power, while the other cores sit mostly idle using less power. Since most tasks CPUs execute today are still single threaded, this can be a big win for overall performance without increasing power consumption as much as increasing the speed of all the cores would.
Most other power saving technologies used in computers affect overall system power consumption and not the CPU itself and/or are only used when the computer is a suspend, sleep or hibernate state and not just idle.