Greetings, Rick,
Frankly, I'd skip 10.2 and go to 10.3 Panther. 10.2 Jaguar always retained that ugly "beta" feel for me. The biggest 10.2 problem I encountered was the "invalid key length error." In spite of what may have been posted here, the only real fix is an Archive and Install of the OS, a royal pain. To top it off, those errors recur, requiring you to do the A&I and subsequent updates all over several time a year. Panther 10.3 seemed immune to this problem. All our Macs that had 10.2 ran hugely better once upgraded to 10.3.
You big issue in upgrading the OS is finding proper disks. Apple have not sold them for years and that means you are cast adrift in the Ocean of the Open Market, where many pirates sail. You need a full retail install disk, not one of the grey system install/restore disks that came bundled with a particular Mac model. In the open market, you will encounter danger in Mac OS versions offered for download (there are no legit copies for download) that are likely packed with malware. You will also encounter burned copies--same problem.
Your best option for finding legitimate Mac OS software is to contact a Mac Users' Group (or "MUG"). You can search for a group in your area with this web page:
http://appleusergroupresources.com/find-a-group/
You may need more RAM for either 10.2 or 10.3. Depending on your iMac's revision code (Rev A or Rev B), you can have at least 256MB and maybe as much as 512MB. Also, 10.2 and higher will eat up close to 2GB of disk space and you have only 4GB. A larger hard drive would help.
As you see, doing any upgrade is going to be costly. A new hard drive and expensive original Mac OSX system software, plus the possibility of needing RAM, will add up fast. If you are doing this to learn about old Macs and cost is not an issue, please go ahead and enjoy it. However, if cost is an issue, you are looking at throwing US$100 to $200 at a $35 computer and still have if be worth $35. That money would be better directed to a newer Mac, preferably one that has an Intel processor and is capable of running the latest Mac OS.