Dissociative identity disorder is a severe form of dissociation, a mental process which produces a lack of connection in a person's thoughts, memories, feelings, actions, or sense of identity.
Dissociative identity disorder is thought to stem from a combination of factors that may include trauma experienced by the person with the disorder.
The dissociative aspect is thought to be a coping mechanism -- the person literally shuts off or dissociates themselves from a situation or experience that's too violent, traumatic, or painful to assimilate with their conscious self.