Hey there!
I have the same model iMac from 2015 and mine runs beautifully with the following:
Use an external SSD
If your Mac currently uses an Apple 5400-rpm hard disk at the startup disk, you can benefit from using an external solid state drive (SSD) as a new startup disk.
To check, open Disk Utility. In the Finder, choose Go > Utilities, then double-click the Disk Utility icon. (Disk Utility is located in the /Applications/Utilities folder.) Alternatively, click Launchpad in the Dock, type Disk Utility in the search field, then click the Disk Utility icon. Once Disk Utility is open, select View > Show All Devices in Disk Utility and look at entry at the top of the hierarchy. If you see "APPLE HDD...", or "Fusion Drive", you can benefit from this external SSD upgrade!
A recommended external SSD, sold from the Apple Store, is the LaCie Mobile SSD Secure USB-C Drive - Gray - Apple. You'll also need a USB-C to USB-A adapter cable, such as the Belkin 3.1 USB-A to USB-C Cable, to connect the SSD to your Mac.
Here are some other options from Other World Computing (OWC) that do not require a separate adapter cable:
To setup the SSD, this user tip should help: Use an external SSD as your startup disk … - Apple Community.
Upgrade to macOS Monterey
When you setup the external SSD, be sure to install macOS Monterey on it, the latest supported version of macOS for your Mac. The user tip Use an external SSD as your startup disk … - Apple Community explains how to, but please let us know if you need help!
-Jack