iMac gets stuck halfway through boot
The symptoms you describe are indicative of a disk drive corruption.  It could be  physical (hardware) or just a file system corruption.

Recovery will require booting from a different drive so you can copy files over.  You can boot from an external USB that has a clean install of OS X (El Capitan would be the latest as your system is not capable of running Sierra) or replace the internal drive with an SSD and attempt recovery via USB.

Personally, I prefer the latter.

The full repair guide is available on ifixit.com, but here are the basic steps you need to go through

You will need the following:


New SSD Drive.  I recommend the Samsung EVO series
USB to 3.5" SATA adapter.  This is so you can access the drive for recovery
El Captian Installation Media. Note that this vintage iMac (2009 through Late 2011) will support up to High Sierra - 10.13.x
Suction Cups (for glass removal)
Torx T10 screwdriver
plastic spudger for connector removal
2.5" to 3.5" kit so the new drive will fit
External HDD for Time Machine (Optional, but highly, highly recommended)


Remove the glass.  The good news is that the glass panel is held in with magnets which you can remove with suction cups and the LCD itself is held in with 10 Torx screws.




Replace the drive. Once you have the panel removed, you will get access to the 3.5" Hard Drive (see pic below)



When you replace the drive, ensure that you replace the temperature sensor, otherwise you will end up with a fan that spins uncontrollably, and erroneous temperature readings.

Just reverse the steps to re-assemble your iMac.

Clean Install OS X. Using the boot media, do a clean installation of OS X.  Then reinstall your apps.

Begin recovery.  Using the USB to SATA adapter, hook up your old hard drive to your iMac via USB.  You should be able to mount it and cp (copy) your data off.  Once done, you can discard your drive (it's quite old and I wouldn't trust it for data storage anymore).  Take it to your local electronics recycler or sell it "as is, for parts only" on eBay; many recovery shops will take it for the PCB or server motors.  You won't get much, but it keeps it out of a landfill.

Set up Time Machine.  I can't stress this enough... having a backup besides (or in addition to) iCloud is extremely important.  Right now, you are finding out first hand how valuable a Time Machine backup can be.