In a nutshell
No single memory is fast, large, and cheap all at once, so computers stack several kinds in layers: a few tiny, lightning-fast registers on top, then caches, then main memory (RAM), and finally disk at the bottom — each step down is slower and bigger but cheaper per byte. A request checks the fastest level first and works down until it finds the data, then copies it upward so the next use is quick. This works because of locality: programs tend to reuse the same and nearby data.