Dissociation is a coping mechanism which allows a person to function normally in difficult situations, by switching off part of their consciousness so that they can function without having to deal with emotions. There are different types of dissociation and different types of dissociative disorders. Dissociative identity disorder (D.I.D) is one of several 'dissociative' disorders and used to be called 'multiple personality disorder'. Its name was changed because it's not technically a personality disorder (because unlike D.I.D I think, if you have a personality disorder, it means you are stuck with it for life: don't quote me on it).
How does D.I.D happen?
If something bad happens to a child they may split off the memory of the event into their subconscious as their ability to process and deal with what happened has not developed. The memories and feelings about it are then held in some other part of the brain and may express as another personality, which the original person is not aware of. This can happen more than one time, so that new personalities form over time. Each part may then contain different memories and emotions and relate to the world in different ways; each part usually has its own function as well.
Basically, the way I understand D.I.D is that we all have 'parts' of our personalities. You might act one way with your partner and another way with work colleagues for instance. But in D.I.D, those aspects of personality have become more separate and so much so that when you are acting in one way, you may not have any memory of the other part of your personality. It is almost like it's a different person. These parts can serve various functions and can be various ages and a person with D.I.D may have any number of parts (also known as 'alters').
A lot of people with D.I.D appear relatively normal; there are more outwardly obvious cases in the media (such as Sybil/United State of Tara) which tend to be a small minority of those who have it. I like to think I appear relatively normal to most people but if you followed me around for long enough you would definitely see that I am not always the way I appear to you. A lot of people may not even be aware themselves that they have D.I.D because it can be so subtle. D.I.D development is useful for a while but once the difficulties that caused D.I.D are no longer an issue, the D.I.D can become more unhelpful than helpful.