There's a great free Yale lecture series called Death that goes into this.
https://oyc.yale.edu/philosophy/phil-176/lecture-12
Version 1: A mad scientist swaps your mind with another person's (Linda's), then asks which resulting body he should torture. Intuition says spare the one with your personality, so personality looks like the key to identity.
Version 2: He's going to torture you, but first gives you amnesia, then makes you believe you're Linda, then gives Linda your memories. Intuition says don't torture your body, so the body looks like the key.