There are many things that can cause a computer to slow down over time. If you have an older computer that still uses mechanical drives (versus solid state drives) you may need to defragment your drive. Solid state drives do not require defragmentation--in fact, it is recommended that you never defragment them. You may also have a lot of "garbage" files clogging up your system--temporary, cache, or log files can generally be deleted. There are free programs out there that will do this for you quickly and easily. One of the best free programs is CCleaner (Crap Cleaner). If none of this helps, then check your Power Profile settings.
Windows 10 has "power profiles" that will reduce the speed of your computer, and its performance, when it decides that you don't need to be running at full speed. As an example, my 3.5gHz processor was running at 800 mHz because of this setting! My Power Plan was set to "Power Saver", how it got set there is anybody's guess, but I suspect that Microsoft automatically set it there during one of their many updates. After I changed it to High Performance my system was running at full speed again, and performance improved dramatically during directory accesses and file transfers. A simple setting, but it can cause a big drop in performance--check it first!
(Note: This tip was written for Windows 10, but may be applicable to other operating systems as well.)