A Pile of Invisible Clutter
A running computer is busier than it looks. Even when it seems idle, dozens of programs and background services are quietly doing things: updating themselves, checking the network, juggling files, reserving memory. Over hours and days, small problems can pile up. A program may forget to release some memory it borrowed. A process may get stuck in a loop. A connection may hang. None of these are visible, but they can slowly drag the whole system down.
Why a Restart Helps So Much
Restarting wipes that mess away in one move. The temporary memory — the RAM the system uses for whatever is happening right now — is completely cleared. Every running program is shut down. When the computer boots back up, the operating system and your usual programs reload from storage into that empty RAM, starting from a clean, known state. Whatever was stuck or leaking is simply gone, because there is no longer anywhere for it to live.
Not a Cure, Just a Reset
It is worth being honest about what a restart really does. It clears the symptoms, but it does not always fix the underlying cause. If the same bug or driver issue is still there, it can build up again next time. A restart is also when many updates finish installing, which is one of the other reasons it so often makes things work properly again. So "turn it off and on again" is not a magic spell — it is the quickest way to give the computer a fresh start.
Source
This article was written using information from Wikipedia.