iMac 2011 Graphics Card issue - Unresolved
You need to repair/replace the GPU card.

This is the iMac with the graphic card issue, so it happened to me as well.
I tried everything except baking the graphics card, this is my absolute last resort.

If you're going to bake it, you may as well just toss it into the bin and save the electricity/gas used to heat the oven.  Baking a PCB is about the worst thing you can do because...

it assumes that the issue is a dry solder joint which the theory is re-flowing the solder will somehow fix the problem.  It ignores that the problem may be something simple like a bad capacitor, resistor or some other component.  Re flowing doesn't fix any of this

you're literally cooking the components on the board so if they weren't bad before, they're likely to be bad now.



What I've done now is I installed Windows on the iMac, and guess what it works perfect, please don't judge but this was only for testing.

Why not judge?  That's a perfectly viable, creative way to test the viability of your iMac.  You got Windows working so you can see that from a hardware perspective, you've got a working machine (well, almost).  Nothing wrong with getting test results that give you definitive answers.

So now, why is it that Windows works but not OSX?

It's integrated graphics versus dedicated (discrete) graphics.  The Intel Core  CPUs have integrated graphics chipset (i.e. HD Graphics, Iris, etc.) as well as a discrete GPU like the Radeon HD 6970M (mobile chip).  When you boot into Windows, it defaults to the integrated graphics whereas macOS is likely set to use &quot;both&quot; integrated and discrete.
How to fix...
You've got two options

The board itself can be repaired.  There are shops that do board level repair.  They can diagnose and replace the specific components that have gone bad.

Replace the GPU (link is about upgrade a 2009/2010 iMac, but it lists all 2011 compatible GPUs)  It may be quicker, easier, and possibly cheaper to simply swap out the GPU with another.  If you go this route, don't toss the bad GPU - you may be able to get a few dollars in scrap value from a board repair shop.