My limited understanding is that this is a common problem with iMacs. I read up on it before buying mine (no problems here) and lots of people seemed to be wrestling with it. I'm sorry I can't be more specific, but I believe there might be a software tweak solution, at least in some cases. Point being, it''s probably not just your Mac, so a Google search will likely bring up more information.
I had a $2000 iMac about 15 years ago where the graphics card melted on to the logic board after just a few years. My guess is that in the endless quest to make Macs thinner and thinner getting rid of the heat became problematic. This is just a theory.