After defeating Giovanni Mewtwo tries to erase the memories of everyone but he can only do that once to a single person. Ash and his friends, and Jesse, Meowth and James memories already got deleted once in the first movie.
Mewtwo can only erase the memories of Giovanni and his team rocket.
Knowing Ash and because he can read his mind Mewtwo knows that Ash will tell anyone about this. So he decides to kill every single person whoms mind cannot be erased. He kills Ash slowly with psychic powers and Ash dies a slow, agonizing torture death. The same happened with Misty and everyone else of Ashs friends. He even killed and tortured the pokemon.
Then he banned Ash's main consciousness into a hell dimension for all eternity because it was his fault that this needed to happen.
But before he did that he copied his mind waves and cloned new bodies for him and his friends. The new Ash clone is undistinguishable from the real Ash and can live on.
He plants Ash's copied mind into the new body.
He does the same for everyone else whose body is dead. He cloned everyone before but there is one difference. Instead of copying their minds and sending the main mind to the hell, he transfered their minds into the new bodies.
Death of the physical body is the only thing that can also erase memories in the Pokemon world so he knew he had to do that.
They would all be well soon after now knowing what happened with new bodys 100% as their old ones. But Ash is not well. Ash's main consciousness is trapped in hell forever, while the copy of Ash's consciousness lives in the new body. His friends can of course not tell the difference since it's a perfect copy. This copy of Ash is also, of course thinking he is the real Ash. But the real mind of Ash will suffer forever in his own hell dimension.
He will feel tremendous pain until the end of time and beyond. His dimension is not tied to the universe. Should the universe itself come to an end in many millenia, his personal hell dimension will not cease to exist. It will torture him forever.
In the final scene we see Ash is trapped inside what looks like a bubble, screaming in agonizing pain as he is forced to watch his friends laughing and spectating his own copy living his dream and having fun in life with his friends. His mental pain is incredible and the physical pain he feels every mere second cannot be described with human words.
