A CPU works by pushing electric current through a resistive circuit and wiring.
When electricity goes through a resistive circuit like in a heating element it gets hot.
The reason behind of heating of CPU is electrons interact with other principal energy carriers .
Electrons that are accelerated by an electric field are relaxed through the energy conversion to phonon (in semiconductors), which is called joule heating.
The CPU is a very important part of your computer and is the brain of the computer and is the Central Processing Unit.
The CPU is responsible for handing all the calculations that your computer does.
The CPU also handles all the instructions you give to your computer such as computer keyboard input mouse input and much more.
Without the CPU the computer would not be able to process anything.