For this 2009 vintage iMac I would recommend upgrade the ram to 8gb or 16gb, install a 250gb or 500gb in place of the internal hard drive. Install all the available MacOS updates & system upgrades so that the firmware is on the latest and then format drive and install Windows 10. As MacOS is no longer supported on these old systems you are better to switch it over to running Windows so that you have longer term software support and can run the latest versions of web browsers & other software.