A CPU, or central processing unit, is the brain of the computer.
Like a human brain, the CPU controls all the functions of the computer.
The CPU's job is to listen for input data from devices like a mouse or other software. Then it looks up instructions for that data, and executes those instructions.
For example, if you type the character "a" on your computer, your CPU will look up how to handle your button press. Once it receives instructions back, it executes your button press, and sends out the output "a".
Modern CPUs can handle billions, or even trillions of these instructions per second.
CPUs are made up of tens of thousands of tiny rods called transistors. Each transistor has either an on (yes) or off (no) state, and form the basis of binary that all computers work with.
With enough transistors asking these simple yes/no questions, the CPU can perform complex tasks.
Modern CPUs are often made up of different cores that make it easier to multitask. Each core is just another CPU on the same chip.
For example, a dual-core CPU has two CPUs on the same chip. These days there are quad-core (4), hexa-core (6), or even hexadeca-core (16) CPUs.
Modern CPUs can also use a process called multi-threading or hyper-threading to be more efficient. This is the process of splitting a CPU up into virtual cores called threads.
For example, if you have a dual-core processor, you might see four cores if you check your computer's system monitor.
These physical cores and virtual cores / threads can make your computer much faster in some cases.
Games usually work better on a single, powerful core. But other programs like video editing software is much faster with more cores and threads.
Check out this video for a high-level overview of how the CPU handles all the inputs and outputs for your computer: