The Egyptians believed that it was possible to live again after death, but this could only happen if the body was preserved in a lifelike form that the spirits known as the ba (personality) and the ka (life-force) could recognise. The body could then act as a bridge between the spirits of the deceased and the offerings provided by the living.
Artificial mummification was a practical response to this desire to preserve the corpse for all eternity. Although the Egyptians are not the only people to have attempted the artificial preservation of the corpse, they are the only people to have held this specific religious belief.
The heart, rather than the brain, was regarded as the organ of reasoning. As such it would be required in the afterlife, when it would testify to the goodness of the deceased. It was therefore left in place within the body and, if accidentally removed, immediately sewn back.