There's a couple of things that I would do.
1. Reset PRAM.
2. Open your user folder/Library. Drag the Caches folder to the trash (yes, the whole Caches folder), then restart.
The Caches folder will be recreated on that restart, and the files in that folder will be created when the system wants to make them again. Empty your trash after that restart.
3. Reset the Spotlight database.
https://support.apple.com/en-us/HT201716
You will find that the spotlight database can take a good 30 minutes to several hours to complete. Your system may drag at times (not a lot!) while that database is rebuilt.
So, give that rebuild about 2 hours to complete, --then, restart to clear memory
and step 4 to think about...
4. If the hard drive is the original hard drive, then it would be a "wonderful" upgrade to replace that hard drive with an SSD. Your Mac's apparent speed will be much faster. You will be amazed (and pleasantly surprised) with your nearly-nine year old iMac.
Keep in mind, too, that your 2007 iMac is at the Bottom Edge (oldest Mac) for supported upgrade to El Capitan.
It will do its best, but may not be really comfortable with that new-fangled operating system, and all of its graphics and CPU needs. Give it the best chance by giving it more RAM (you can go to 6GB, but your 4GB may be "OK", too.
And do consider the SSD. IMHO, that's the OTHER link to a "best job" upgrade to El Capitan.