Consider what happens when you rub your hands together at millions of cycles per second (or even just 5 times a second).
Heat is produced, its a direct by product of what is being done.
I think "It's physics" is a likely answer here.
Some electronics can reduce it by design however there is always a cost overhead for this and products are being produced for least cost.So they produce heat, yes inefficiently but for the cost that allows the product to be sold to you at the price you pay.
The CPU in your PC is wroking extremely hard & fast and produces lots of heat that needs taking away with a heatsink and fan, the CPU is getting faster and more powerful and the heatsink needs to get bigger etc to take away the increased heat produced.
Cheap power supplies are cheap and inefficient, but they are cheap.
If you want a cool running efficient PSU then you will likely pay more for it.
You get what you pay for.