Humans have this almost paralyzing fear of death. One thing that keeps it from being paralyzing is this belief in what’s called symbolic immortality. It's this sense that our symbolic selves, our identities, our ideas, can continue on after our deaths as part of our legacy through the meaning that we create in the world and the deeds that we do before we die.
To the degree that this belief in symbolic immortality reduces fear of death by seeming sort of like actual immortality -- as if you will actually live on through your acts -- that’s actually an example of magical thinking. But it can be positive if it reduces existential angst or if it encourages you to try to accomplish great things while you’re alive in an effort to fortify your legacy.