Why is my MacBook Air faster than my iMac?
One main difference between the two computers is that your MacBook Air has an SSD - a solid state drive - for data storage, whereas the iMac has an ordinary hard drive. SSDs are typically an order of magnitude faster than hard drives, so if your usage of the computer involves a lot of disk usage, that could explain the perceived speed difference.

Another difference is the processor. Here the iMac has the advantage with a CPU that potentially is up to about 3 times faster than the CPU in the MacBook Air. However, if your specific usage of the computer does not involve a lot of heavy CPU usage, or your programs are not written to take advantage of multiple CPU cores, then that advantage could possible be minor.

Even considering these differences between the two computers, you shouldn't have a "painfully slow" experience on the iMac. If it was quick, and now is painfully slow, it doesn't sound like the hardware is just insufficient for the task. It sounds more like a software problem or possible a hardware defect.

I would suggest testing the software hypothesis by installing macOS on an external USB drive and see if that improves performance - or if you have no problem rolling your computer back to an earlier date, then by restoring an earlier Time Machine backup from before you've experienced the slow downs.

In terms of a hardware defect, you could suspect something like a cooling problem. If that were the case, you would probably hear increased fan noise, and/or you would see kernel_task as having a high CPU percentage in Activity Monitor, which the screenshots does not show. Therefore it doesn't seem that a hardware problem is likely just now. You could check your logs (using Console.app) to see if you have any error messages about your disk drive - timeouts here could give massive slow downs throughout the system.