Protector of heart
For the egyptians everything important in life was connected to the heart. It was the home to the spirit - intelligence, life force, emotions, moral, memory.. everything. Life was lived by heart. Literally.
When time had come to an end and you were about to leave this physical world, your heart was the key to the blissful afterlife.
A balance was used to weigh the heart against the feather of Maat. A sinless and light heart was the only way to another life. If the heart was heavier than the feather, the soul would be destroyed forever.
The heart scarab was used as a protector of your heart, as an amulet it was believed to increase your chances to pass the test.
On the back of the scarab, chapter 30 B in "The book of the dead" was inscribed in hieroglyphic text:
"O my heart which I had from my mother, O my heart which I had upon earth, do not rise up against me as a witness in the presence of the Lord of Things; do not speak against me concerning what I have done, do not bring up against me anything I have done in the presence of the Great God, Lord of the West."
The heart scarab of Hatnefer / Pictures from metmuseum.org