Locke used a series of cases to make three points:
Locke maintains that a person is a different kind of thing than a man. A man is a kind of living creature: a human one (§6). A person is a thinking thing (§9).
Person and man usually go together. But they can come apart: that’s the lesson of the prince and the cobbler (§15). If people can switch bodies, persons have to be distinct from bodies.
Specifically, if the person of the prince can move to the cobbler’s body, then having the same living body as the prince is not a necessary condition of being the prince. And having the cobbler’s living body is not a sufficient condition of being the cobbler.
But why should you believe that this story shows anything about what is genuinely possible? That’s a nice question. Locke took it for granted that the imaginative possibility was convincing evidence. If you could imagine waking up in someone else’s body, that shows you think it’s possible for you to switch bodies. Perhaps it’s not technically possible, but it’s logically possible, in this way of thinking.
I don’t know how to show that Locke’s assumption about the relationship between what we can imagine and what is possible is either right or wrong. But I strongly suspect that the sort of thing he described, where one person’s psychological characteristics are imported into a different body, will be technically possible. So future people are going to have to decide if that really counts as switching bodies or not.
Locke also maintains that the identity of a person is distinct from the identity of what he calls substance. There are two kinds of substances that might be relevant to the continued identity of a person: matter and immaterial spirits or souls. Locke held that the identity of a person is independent of the identity of either kind of substance.
This talk about substances is hard to grasp, though. Here’s a way of thinking about it.
You are a thinking thing. That’s what a person is, after all. So what is the thing that thinks?
A natural way of answering that question is to say something like this: “the thing that thinks is the stuff that does the thinking, like, the brain.” Or, if you were one of Locke’s contemporaries, you would have probably said something more like this: “the thing that thinks is the stuff that does the thinking and will continue to exist in the afterlife, namely, the immaterial soul.”
Locke saw things differently. He thought that the thinking thing is identified by what he called consciousness. He was particularly impressed by an analogy with living creatures.
A living creature consists in an organization of parts; its identity over time is compatible with changing the underlying parts.
Persons consist in conscious awareness that is essential to thinking. The identity of persons over time is compatible with changing the underlying stuff just as the identity of plants and animals is compatible with changing their underlying stuff.