First:
PRINT OUT THIS REPLY.
Save it for reference.
You are going to need another working Mac to do what follows.
Do you have one?
What is it?
What version of the OS is running on it?
Internet recovery DOES NOT WORK with a 2009 iMac. Don't bother trying.
A 2009 iMac can run OS versions up to 10.13 High Sierra. That's what we'll install.
OK,
you are going to need some files and tools.
I'll tell you what you need and where to get them.
Download dosdude1's "High Sierra Patcher" tool by clicking this link:
WE ARE NOT GOING TO PATCH ANYTHING.
We just need this tool to get High Sierra.
Hopefully the working Mac you have will run this tool.
Launch it.
IGNORE THE WARNINGS IT PRESENTS (such as "natively supported machine" or whatever).
We aren't going to need them.
Go to the "tools" menu (in the menu bar).
There should be an option to download High Sierra.
So... download it to the desktop.
Don't worry about what it downloads as (pkg, etc.) -- just download it.
When done, you should have the High Sierra installer on the desktop.
Once you have that on the desktop, you don't need the HS Patcher tool anymore.
Just quit it.
Now, we need more tools:
I'm going to present TWO utilities.
You will need only one, but
DOWNLOAD BOTH OF THEM.
If one doesn't work for you, TRY THE OTHER ONE.
1. DiskMaker X:
2. Install Disk Creator:
What’s needed for a clean install on a Mac A backup of the disk before it’s erased. Two options are to use Duplicate (a free utility which can copy and paste an entire bootable volume), or Mac Backup Guru (a paid, fully featured backup utility with unique incremental backups capability) for...
macdaddy.io
Both of these are tools which will take a USB flash drive and (using the OS installer) will create a BOOTABLE install drive.
You will need a USB flash drive, I recommend 16gb or larger.
IF ALL YOU HAVE is 8gb, try that, it may work.
Just launch either of these, the instructions are self-explanatory.
Again -- try ONE of them first.
If that doesn't work, try the other one.
Can you get the bootable USB flash drive made?
It will take a little while for the utility to create it, so be patient.
When done...
THE ACID TEST:
Plug the flashdrive into the iMac's USB port.
Hold down the option key and keep holding it down.
Press the power on button.
You should see the startup manager, select the flash drive and boot.
If it boots, that's the BIG STEP forward.
I would use disk utility to erase the internal drive AGAIN.
MAKE SURE you go to the view menu and choose "show all devices" so you can see the internal drive.
Erase to "Mac OS extended, journaling enabled, GUID partition format".
Then quit disk utility and open the OS installer.
See if you can get the OS installed.
Good luck.