You may want to look into the transistor and why it heats up. Since cpus have millions+ of them, you will have your answer.
In short, Nothing is 100% efficient and cpus despite getting better(still turn most of the power into heat) still transform a good portion of the power coming in to them into heat.