The iMac model number is located on the bottom of the foot.
That model number can be used to determine which macOS versions can be used.
In general, you’ll need another Mac to build a bootable installer here, as you’re very likely too old for Internet recovery from firmware. As far back as these iMac models seem to be, recovery was booted from a partition on the internal storage, and yours here has likely been wiped to make more room for the other operating system.
The assisting Mac will need to be old enough to run whatever the newest macOS for your iMac, or Apple won’t download the macOS version you need to the assisting Mac.
Once downloaded, build a bootable installer, then transfer to the target Mad, boor the installer, wipe the the storage, format the storage as GUID partitioning and with Apple Journaled (HFS+) file system, and then install macOS into the partition.
Links:
Create a bootable installer for macOS - Apple Support
How to download macOS - Apple Support