Well the primary problem is you bought the most basic iMac that was ever made, the 21.5" models that have glacially slow 5400 RPM HDs installed. That is the main bottleneck to an otherwise capable computer. It is also now 6 years old and may not be in good health.
That being said before you do ANYTHING please backup the computer as your data is at severe risk and if the HD is failing you will lose ALL of your data!!!!!!!!!!!!!! There is ZERO reason to not backup the computer daily using Time Machine which is pre-installed on your Mac, all Time Machine requires is an External Hard Disk such as the OWC Mercury Elite Pro series. A 2-4 TB External Hard Disk is recommended!!!
After you have the External Hard Disk please read Back up your Mac with Time Machine!!!!!!!!!!!!!!!!!!!!!!!!!!!!
After. you have backed up the computer leave the External Hard Disk connected and Time Machine will backup regularly.
THEN AND ONLY THEN you can begin addressing the issue you posted about. What I would recommend is that you run a DriveDX report and if the HD shows ANY errors then your HD is failing and MUST be removed from the equation.