There's a simple answer to the question of why humanity has a history of burying the dead: to prevent the rotting of a corpse. It makes perfect sense, and it actually is a big reason behind the burying of dead bodies. However, it's also been observed in different cultures around the world that burials become a ceremony, akin to a wedding. Loved ones are placed in caskets, or coffins, or wrapped in fine garments that will keep the body comfortable. Very often the dead are also buried with personal effects, such as books, food, family heirlooms, and in warrior societies like the Celts or the Vikings, armor and weapons.
This is not something that's been observed in a single place. Rather, it's been observed almost everywhere in the world, even among other species. Human civilization, in particular, has had an almost universal trait of the ceremonial burying of the dead. So, it begs the question as to why humanity has this natural inclination of complex burial procedures, for both loved ones and strangers. Is it one penultimate reason, or a summation of many?
The most obvious and most common explanation behind the ceremony of burials is the love and respect that loved ones have for their elders, ancestors, family, and friends. When someone they love and care about passes away, they feel grief and pain over their loss. The act of taking care of the deceased's body and showing it respect and love for one final time helps the grieving process and allows the family and friends time to reminisce and come together in mutual love of their departed. This can be seen in the gentle care the body is granted, from the cleaning and dressing of the corpse to the careful preparation of the final resting place, whether it be wrapped in silk or placed in a cushioned coffin. They wish to take care of their deceased in death the same way they took care of them in life.
The other common theme in the ceremony of burials throughout human history is the idea of the deceased making a journey to the afterlife. The Ancient Egyptians believed that the ceremony of burial was instrumental in ensuring that the deceased had a peaceful and easy trip to the other side. They would embalm the body, mummify it, and entomb it in a sarcophagus decorated with inscriptions, drawings, and offerings to the gods. The Egyptians viewed death as a passing over of sorts, where the essence or the soul of the person would simply leave their earthly body and transfer over to a new form of existence, and the act of burying the deceased body ceremoniously was done to ensure this transference was swift and without issue.
The Celtics and Vikings also had strong beliefs in an afterlife and would ceremoniously bury their dead either after they died in battle or from natural causes. The Celtics would wrap their dead in linen, bestow on them gifts such as family heirlooms, food, armor and weapons, both as offerings to the journey they had completed in this life, and tools to help them in the journey beyond. The Celts believed the family heirlooms would help the disembodied souls hold a tether to their still Earth dwelling family and descendants, so that they may be protected from beyond the grave, while the weapons, armor, and food were meant to assist the deceased on their journey to the afterlife in case they run into any unsavory ethereal beings. The Vikings believed in different realms of the afterlife, all depending on their actions during their life and how they died at the end, most famously with warriors killed in battle going to dine and drink mead with Odin in the hall of Valhalla.
Burying the dead is one of the oldest traditions in human history, and there is a litany of reasons relating to why it is done. Each society has had its own reasons and beliefs behind their burying of the dead. Perhaps they were all right? It's definitely a possibility, but there's no way for us to know. Yet.