Diagnosing what's wrong with "vintage" iMac
From the sound of things it is likely the hard drive. An "easy" way to find out would be to attach an external HD and install the OS on that.

Be aware that depending on what is going on with the old HD it could eventually just prevent the Mac from booting as the Mac tries to access it even if it is NOT the boot drive.

Note that a USB drive would be SLOW, Firewire would be preferable and, while it is not as fast as SATA, would provide you with a generally usable/bootable Mac while you work up the courage to open it up and replace the drive ;-).