The Murders for which Malcolm was arrested did happen and Malcolm did indeed commit them. The plot of the identity is sort of a combination of Fight club along with the famous Agatha Christie novel namely "And Then there were none".
Malcolm committed the murders but he has a split personality disorder and there are 10 personalities to him, Dr. Mallick tries to convene all his personalities in a single place that happens to be the motel as part of the experiment to isolate the killer personality who is actually causing Malcolm to commit the murders he did in the past.
Every event which happens in that motel is happening in Malcolm's head and it includes only his 10 personalities, the other set of events are the actual events with the real Malcolm who is being presented to the jury the day before his execution by the Doctor to plead to them on the basis that its not Malcolm who did those crimes it was an aspect of his split personality with in him.
Dr. Mallick's idea is to eradicate the killer personality because he was the one who committed the murders but the other personalities were completely innocent it includes even the convict Rhodes with the help of John Cusack's personality, who appears to be the most sane personality among the others because of him being a cop prior.
(Unfortunately they zone in on the wrong personality and the killer personality happens to be the little kid who is never suspected throughout the movie. Malcolm is now rid of all his good elements and is completely taken over by the evil personality, which is why he proceeds to kill the doctor.)