Allan Jones wrote:
If you are not already running 10.13, there are no ways to go higher because the video hardware technology that macOS 14 and higher require does not exist for a 2009 iMac. Do not fall for bad recommendations to use hacks to install something unsupported.
I think this didn't come out how you meant it. It sounds like you meant to say "If you are already running 10.13.6" but instead wrote "If you are not already running 10.13."
If that iMac is not already running 10.13.6 (High Sierra), there's probably a way to upgrade that Mac to it. (It may be more "interesting" if the Mac is currently running Snow Leopard (10.6) through Yosemite (10.10), which might not be able to access How to download and install macOS - Apple Support or the App Store.)
High Sierra is six major versions behind Sonoma, and there are many modern Mac applications that will not run on High Sierra. So the OP shouldn't expect an upgrade to High Sierra to make that Mac work like a modern one.