Biography
In real life, Dissociative Identity Disorder (or DID) is a condition in which more than one distinct personality can be observed at different times within a single individual's brain, often associated with long-term childhood trauma, resulting in a system or a multiple rather than a singleton. Long thought to be rare and often misdiagnosed, DID actually occurs in about 1%-3% of the population.
Not all cases of multiplicity can be diagnosed as DID. Systems that don't meet DID criteria may instead be categorized as "Otherwise Specified Dissociative Disorder" (OSDD-1, formerly DD-NOS). Yet other systems are a healthy Split-Personality Team or Mind Hive, working well together and functioning well in daily life. In the absence of impairment or distress, these systems need no diagnosis.
A variety of theories address the origin of DID and its cousins. The theory of structural dissociation proposes that everyone starts with an unintegrated personality; but when childhood is disrupted by trauma, these parts may not integrate, resulting in DID. Other theories model DID as the result of coping with trauma by dissociating and imagining that the trauma is happening to someone else. Non-traumatic causes for DID and healthy multiplicity have been the subject of very little research.
(DID was originally called "Multiple Personality Disorder", but the name was changed to clarify that dissociation and separate identities were key to the disordernote Nowadays, dismissing alters in a multiple system as "only a personality" comes off as offensive or ableist.)
Though DID starts in childhood, it often persists into adulthood. The individual has no control (at least initially) over when the alters "switch", and may not initially remember what they did, or what happened to them, while an alter was active (dissociative amnesia). To put all that in Tropese: you go to your Happy Place while some poor Red Shirt has to deal with the Trauma Conga Line or Humiliation Conga—so stereotypically, the personality who has to deal with it is not a nice person...
In fiction, two (or more) alters, each of whom may or may not share memories and may or may not be able to access other alters' memories, may switch at will or involuntarily; they may be at war, or have formed a truce, or be allies. Some systems may experience life as one person (i.e. having the very same mind, memory, and desires), but with behavior modes or frames of mind that switch between several distinct states. This diversity of experiences is Truth in Television for what real multiples report experiencing.
It's worth noting that rather than create a new identity from scratch, the brain afflicted with the disorder takes personality traits that are already there and heavily compartmentalizes them as a form of dissociation. Thus, therapy for DID typically has the end goal of decompartmentalizing the brain so that the personality traits and memories of the alters become integrated.
Characters with a split personality are surprisingly common in fiction, but most of them don't quite match the textbook definition of DID. In older media, it will often be called "schizophrenia" even by psychologist characters, despite the fact that DID and schizophrenia are completely unrelated disorders. (Schizophrenia causes hallucinations, psychosis, and thought disorders. The confusion comes from the fact that the word schizophrenia literally means "split mind", because a main symptom is scattered, unconnected thoughts.)
See also Double Consciousness, Identity Amnesia, Jekyll & Hyde, Napoleon Delusion, Superpowered Evil Side, Split-Personality Merge, Split-Personality Makeover, Split-Personality Switch Trigger, Split-Personality Takeover, and Talking to Themself. If the split personality is the antagonist, it's the Enemy Within. Shapeshifting is sometimes involved. If the personalities are flipping back and forth, Flip Personality often ensues.
Compare Trauma-Induced Amnesia.
If the two personalities are aware of each other, expect a Gollum Made Me Do It situation to develop. Resolving it may require the weaker of the two to say "I'm Not Afraid of You!" If the Split Personality gets its own body, it becomes either a Literal Split Personality or an Enemy Without (if said personality is antagonistic or evil). See also Heroic Safe Mode for one explanation as to how a side like this can be created.