The British Museum's website explains that "the earliest ancient Egyptians buried their dead in small pits in the desert. The heat and dryness of the sand dehydrated the bodies quickly, creating lifelike and natural 'mummies'." (Mummification, Ancient Egypt | The British Museum)
The Ancient History Encyclopedia explains that although unintentional mummification happened as far back as prehistoric times, mummification as a purposeful and ritualistic process started around 2600 B.C.E. It was a long and expensive procedure which is why mummification was first reserved solely for Pharaohs whose mummies were placed in opulent tombs or pyramids. (Mummification in Ancient Egypt, Ancient History Encyclopedia)
The methods of embalming, or treating the dead body, that the ancient Egyptians used is called mummification. Using special processes, the Egyptians removed all moisture from the body, leaving only a dried form that would not easily decay. It was important in their religion to preserve the dead body in as life-like a manner as possible. So successful were they that today we can view the mummified body of an Egyptian and have a good idea of what he or she looked like in life, 3000 years ago.Source: Egyptian Mummies, The Encyclopedia Smithsonian
The Biblical Archaeology article also explains that prehistoric Egyptians first preserved the bodies of their dead by leaving them out in the hot, dry desert. It further adds that "the use of resins and other embalming agents to preserve bodies after death was thought to have begun during the late Old Kingdom, circa 2200 B.C.E." As for how researchers found that mummification in ancient Egypt is much older than previously known, the article explains best:
An 11-year study conducted by researchers from the Universities of York, Macquari and Oxford used gas chromatography-mass spectrometry and thermal desorption/pyrolysis to examine linen wrappings in Late Neolithic and Chalcolithic (c. 4500–3350 B.C.E.) tombs in cemeteries at Mostagedda in Upper Egypt.
Wrapped around the bodies of the entombed, the linens were found to contain some of the same embalming agents—in similar proportions—that were used over a millennia later in Pharaonic mummification in Middle Kingdom Egypt.Source: Ancient Egyptians Mummification, Biblical Archaeology Society
How amazing that modern science and technology have helped researchers learn that mummification was intentionally practised as far back as five thousand years ago and earlier, instead of 'only' from circa 2600 B.C.E. This breakthrough in what we know about the ancient Egyptians would not have been possible fifty or a hundred years ago as humanity's knowledge of science and technology simply wasn't advanced enough. Just imagine what we might learn ten, twenty or fifty years from now!