The puzzle is easy to feel and hard to solve. You are confident you are the same person who existed twenty years ago, yet you could not produce a single feature that has persisted unchanged. The matter has turned over. The personality has shifted. Most of the memories are gone, and several of the ones that remain are demonstrably wrong. Something makes the claim true anyway — or else the claim is not quite true, which is stranger still.
The simplest answer is bodily: you are the same person because you are the same living organism, a continuous physical process persisting through the replacement of its parts, like a river that stays the same river as different water passes through. This handles ordinary cases well. It struggles with the cases philosophers care about, because it delivers verdicts most people reject — if your body survived with none of your psychology, most of us would not say you had survived.
Locke shifted the ground decisively by making consciousness the criterion. You are the same person as whoever you can remember being; identity follows the continuity of consciousness rather than of substance. He dramatised it with the prince and the cobbler: if a prince's consciousness came to occupy a cobbler's body, the resulting person would be the prince. That intuition is powerful, and it is the ancestor of every body-swap story since.
The memory criterion faces a well-known difficulty from Thomas Reid. Consider an old general who remembers being a young officer, who remembered being a boy, but the general no longer remembers being the boy. By Locke's rule the general is the officer and the officer is the boy, but the general is not the boy — and identity is not supposed to work that way. The standard repair replaces direct memory with overlapping chains: psychological continuity, where each link connects to the next even if the ends do not touch.
Derek Parfit then pushed the whole debate somewhere unexpected. Using fission cases — imagine each half of your brain transplanted into a different body, both survivors psychologically continuous with you — he argued that identity questions can lack determinate answers. Neither survivor is you, both cannot be you, and yet nothing has been lost that you should care about. His conclusion was that identity is not what matters: what matters is psychological connectedness and continuity, and these come in degrees. If he is right, the question we started with is less important than it feels — and Parfit reported finding that thought liberating rather than distressing, since it made his own death seem less absolute.