The Book of the Dead was not really one book - it was a collection of about 200 different spells, prayers, and instructions. Ancient Egyptians believed the afterlife was full of dangerous tests, scary monsters, and tricky judges, so they wanted help getting through it. Wealthier Egyptians paid scribes to write a custom set of spells just for them on long papyrus scrolls.
The scrolls were placed inside the coffin or wrapped up with the mummy. The Egyptians believed the dead person could read or recite the spells in the afterlife to pass each obstacle. One spell helped them get past Anubis. Another helped them join the gods on the sun boat of Ra.
One of the most famous spells told the heart not to betray you when it was weighed on the scale of justice. The Egyptians used the Book of the Dead for about 1,500 years, and many original scrolls have survived. The British Museum and the Cairo Museum each have huge collections of them today.