and why is it using so much of my CPU?
If you have opened the CPU tab of the Activity Monitor on your Mac, you will probably have found a process called “kernel_task”. First things first. It's not a virus - you haven't booted into Windows by mistake - It’s actually part of your operating system, macOS.
What is a Kernel
A Kernel is main part of an operating system. For those of you who don't know, the operating system, macOS, controls the basic functions of your computer. It controls access to the memory chips, or to the data stored on the hard drive. The operating system allows multiple apps to run at the same time because it juggles the assets of the computer.
The kernel is at the core of any operating system. It sits between the CPU, the RAM memory and the other hardware. When your Mac is turned on, the kernel is the first thing that starts. Pretty much everything that you do on your Mac goes through the kernel at some stage. Activity monitor lists all this action as kernel_task
Why is kernel_task using so much of my CPU
If your Mac is running slowly, or the fans are spinning loudly, it may be because some process is using up too much of your CPU. If you open activity monitor and notice that kernel_task is using a majority of your system resources, you might have a problem. It's a cliche but it works sometimes, so let's turn it off and turn it back on again.
Restarting your Mac is the only way to restart your kernel, and sometimes that will solve all problems.
kernel_task Pretends to Use CPU Cycles To Keep Things Cool
But it's much more likely that it won't fix the problem because kernel_task works counter to how you would imagine. If your Mac is doing something that uses a lot of CPU power, like transcoding videos, you will notice that kernel_task is using a lot of the CPU in Activity Monitor. Your first instinct might be to kill that task so that your transcoder can be faster. But macOS detects when the CPU is getting too hot, and uses kernel_task to cool it down. So killing that task may actually cause your CPU to be damaged.
According to Apple;
One of the functions of the kernel_task process is to help manage the temperature of your CPU.
Activity Monitor might show that a system process named kernel_task is using a large percentage of your CPU, and during this time you might notice more fan activity.