Imagine a large library of books arranged in volumes. Also imagine that the librarian for this particular library re-shelves the books in a way which moves the individual books in the volumes further apart from each other. As more books are added to library, the further apart and more mixed up the books in the volumes become. Now imagine that you come to the library and want to check out an entire volume of books. You would have to search all over the library to find each individual book in the volume that you want. In computer terms, what is happening when the individual books are re-shelved in this way is called fragmenting, and this is what happens to your computer as you install programs, download files, or just use your computer in general.
When running programs that contains hundreds of files, fragmenting can degrade the performance of your computer. As the clusters of files on your hard drive become fragmented, they grow further apart and it takes longer for your computer to find and assemble all the pieces necessary to run the programs. This is where defragmenting comes in. It rearranges the files on your hard drive so they are back in order, which cuts down on access latency (the time it takes to access your files). It is as if the library has hired a new librarian who goes through and arranges the books so that the volumes are intact and contiguous. This would greatly reduce the time it takes to find whole volumes or individual books in those volumes.