iMac with 8 GB memory and a hard disk drive? (See 🍎 > About This Mac… for config details.)
If so, the performance on these is poor, and the best bad option is relocating your contents to an external SSD.
Here’s a write-up on iMacs with too little memory and too-slow hard disk storage:
… Why is my hard disk drive iMac so slow? - Apple Community
If it’s some other iMac configuration, ensure you have complete and current backups, as what you’re reporting can also indicate a hard disk drive failure is underway. Failing hard disk drives can show slowdowns, beachballs, performance degradation, and eventually crashes, hangs, and failure.
If this is some other configuration, please download and run EtreCheck, and share the report to the clipboard. Then open a new reply here, and press the Additional Text button that looks like a printed page to get a text input box big enough to paste the hardware and software configuration report here.
Other causes of performance problems can be add-on cleaning apps, add-on VPN apps, add-on “security’ apps, and related, as well as malfunctioning apps, and adware and other undesirable apps, as well as corruptions and other issues. The EtreCheck report can help us locate these problems.