The highest OS that iMac can run is mac OS 13 "Ventura." Upgrading the OS is the LAST thing one should consider when faced with a slow computer
"Dual-core" means you have the crippled educational/institutional iMac, intended for cost-conscious bulk buyers with limited computer needs. It was never fast. The standard consumer model in 2017 had a 4-core processor at minimum running at 3.0Ghz. Nothing can change that.
Most reports of slow iMacs made between 2012 and 2019 are due to the the glacially slow mechanical hard drives Apple opted to fit as the base storage config. They are demonstrably slower than even the base 2011 iMac 21.5.
There is one thing you can do at home that will help until you get a newer computer. However, before offering that, we need data to tell us if this is the hard drive or something else.
If you want a data-driven evaluation in this setting where we can neither see nor touch your computer, please post an EtreCheck report. We can quickly and within the limitations of these forums help you determine what issues are at play without our playing a protracted game of "20 Questions" with you that could go on for days.
EtreCheck Pro is available here: https://etrecheck.com/index
The free version will do nicely for this purpose, although the app is worthy of our financial support.
We can see hard data about drive performance, software issues and interferences, and RAM usage. Etrecheck is the development of a long-serving and trusted ASC contributor. It is a reporting app, not a "fix-it” app, expressly for displaying information in these forums to help us help you remotely. It will not reveal any personal or secure information.
Please see this excellent user tip on how to post long text reports like EtreCheck's into a forum response:
How to use the Add Text Feature When Post… - Apple Community
I'm asking the Moderators to move you to the iMac forums. This one, "Using the Communities," is for asking about the forum software, but has morphed into a dumping ground and gets few views from the hardware experts.