This is a bit of a loaded question, as there's multiple components to it... but let's demystify things a bit.
First up, a newer computer (with the same specs) will ALWAYS appear to run better (or at least smoother) for the following reasons:
* There's less temporary files (or junk) on the drive.
* There's less "junk" (unused, removed or errors) in the registry
* There's likely more open space on the storage drives.
* Files are likely going to be in one piece (No or minimal fragmentation) on the drive (HDD's ONLY)
* Files are likely going to be in sequential order on the drive (HDD's ONLY)
Second, as you use your computer, the items noted above will EVENTUALLY occur & will create some "clutter" as you install updates, modifying files & removing programs you're no longer using. While doing a full reformat & reinstalling the OS & your files is generally the best option to refresh your system, it's highly time consuming (talking hours & possible days) & not fully practical to do more frequently than once a year.
Utilizing disk cleaners (like CCleaner) is an easy & safe method to help reclaim some storage space. Using a registry cleaner (like Eusing's Free Registry Cleaner) can help improve stuff as well, but it's not as safe to perform (as long as you stick to what the app is considered safe & you create a restore point first, you should be OK).
Here's the detailed stuff here...
> Keeping your storage drive clean affects performance
For any computer & computer-like device (Tablet, Smartphone, ect.), it's generally recommended to keep about 10% of the storage drive open to maintain system performance. The main deal here is that all those temporary files (in the cache or page file) need some place to hold them for the brief moment they needed.
THIS BECOMES MORE CRITICAL FOR SOLID STATE DRIVES. The storage management system of the SSD's tends to "juggle" data more often among the storage cores as part of it's wear-leveling system & is more willing to move the updated file into a new spot & marking the old location as available than update the existing location (as part of the TRIM function, as SSD's have to rewrite an entire block of data to change a few sections in it). The free space is utilized for this function, so the less free space there is, the more re-writes are required to juggle the data to their final destinations & the faster the drive wears out. HOWEVER, SSD's tend to get pre-formatted & pre-allocate some space just to accommodate this. This is why you're seeing some odd numbers for storage space like 500 GB (vs 512 GB) & 960 GB's (vs 1024 GB's) as they're reserving some storage to maintain performance.
> Keeping the registry (relatively) clean & error-free can affect performance
Similar to the storage drive, keeping the OS registry clean helps to keep things running smoothly as there's less junk the OS has to deal with. Whenever you uninstall an app, it may leave some stuff in the registry that might cause some minor issues down the road. If there's an error in the registry, that can cause some performance hits as the OS tries to address (& potentially correct) the issue.
HOWEVER, the registry is a more sensitive area of the computer, so unless you know what you're doing... it can royally screw things up (where you can brick the system at the OS level). Most registry cleaners only modify / delete registry keys & values that are safe to do so.
> Keeping files defragged on HDD's can help with performance
This is pretty self explanatory & practical... It's easier for your computer to read a file if it's in one whole block instead of multiple pieces, like a jigsaw puzzle. HOWEVER, this doesn't apply to SSD's, since they can read a file that's broken up in multiple parts almost instantly (as the HDD has to wait for the data to run past the disc head).
Microsoft has actually included their disk defragmentation utility as part of Windows (or at least Windows 10) maintenance process, as it's schedule to run on a weekly basis (typically when your system is idle) on all HDD's. As a result, you don't really need to use an outside utility program to handle this.
> Keeping program files in sequential order on a HDD can help with performance
This is just a logical extension of file defragmentation. As programs want to load up files in a particular order, so performance can be improved if your computer can just do just one long, multi-file read cycle than multiple read cycles across the drive.
Some outside utility programs (not built into Windows) may allow you to optimize the placement of files on the HDD, where more frequently accessed stuff gets placed in the center of the drive while rarely accessed archives are placed on the outer edge of the drive.
That's about the gist of it. The TL;DR here is that just doing some regular "housekeeping" tasks can help keep your system's performance up.
Hope this helps!