When people think "a legacy" they mean an empire, a code of law, a discovery, being a pain in the ass to such extend your assholery goes down in the history books, inspiring legions to do your bidding that wrecks the order of the world and such.
Even then, when you change the world, your name may be forgotten. Your accomplishments disregarded, no matter how influential they were. How many remember the emperor that legalized Christianity in Rome? Who knows that the idea of inherent human dignity, the basis for what we would call a democratic, free country originated in ancient Persia, not Greece and Rome? Countless examples I do not remember or have never heard about, we could scour the internet for the whole night (or day, wherever we all are) and still not name all, some we would never name, people lost to history.
When people talk about "leaving a legacy" they think about a name living on, bragging to their closet family and friends what their child is growing up to be, and, something I know from my own life, having a family line in the business because they know/heard of a family doing exactly that and being somewhat relevant in the field in this century and little else.
You are not important enough to be remembered in two generations, your only "legacy" is a codex of unfulfilled dreams and delusions of grandeur.
People's inability to grasp their own insignificance not only to the universe, to the human race (and we are talking purely Homo Sapiens here) but to their own families and even grandkids and still being sure they are doing something groundshakingly important, even on the family scale is astounding.