"fairly old iMac" is not exactly detailed specs to elicit a decent answer.
Basically, the G3 iMac, would settle out at 10.3.9 while the G4 iMac would be happy with 10.4 (Tiger)
Some of the later G3 iMacs would handle Tiger but would not give a decent user experience.
As to the actual upgrade, if you do an "Upgrade", then all our files should remain intact and usable after the upgrade
I'm fairly illiterate when it comes to technical things like this. If I attempt to do this upgrade on my fairly old iMac, will it work? And if it does, will it wipe out old files on my computer?
thanks in advance