https://en.wikipedia.org/wiki/Fugue_state
It is a rare psychiatric disorder characterized by reversible amnesia for personal identity, including the memories, personality, and other identifying characteristics of individuality.
The state is usually short-lived (ranging from hours to days), but can
last months or longer. Dissociative fugue usually involves unplanned
travel or wandering, and is sometimes accompanied by the establishment
of a new identity.