The answer to this question is not in the anime.
It's one of the main plot points in the work, and fully explained in the manga. Actually, MOST of what Shiro is is explained in the last chapters of the manga. So, you are NOT supposed to get her from the anime.
Some spoilers ahead.
Shiro is not a prisoner. She is actually a test subject from a research laboratoryy, the reason why the Branches of Sin exist, and the responsible for the earthquake that destroyed Japan. The prison was built later, above the lab she was experimented on, as a facade for the testing on people who developed Branches of Sin after the earthquake.
She escaped the prison simply because there is no real way to contain her at all.
Yes, she killed all of Ganta's classmates out of jealousy.
Extreme spoilers ahead.
In the past, Ganta knew Shiro, because his mother was on of the chief researchers at the laboratory, extremely involved in the inhuman experiments the girl was subjected to.
Gantas cared a lot for Shiro, and she liked him a lot too. They pretended to be each other's hero, "Aceman".
But in one experiment, a broken Shiro decided to kill some researchers to show her control over her developing powers, and Ganta ended up witnessing it. The shock made him forget what he saw, and forget about Shiro. He was then sent away to live in the city.
Some time later, Shiro would cause the earthquake trying to die. She still survived, and Ganta's mother built a system to seal the girl's powers to an extent, so she would not be able to try that again. She also gave the girl a small red stone she had developed in the laboratory. It was a substance that could null Shiro's powers. Ganta's mother then killed herself so no one would be able to deactivate the system and free Shiro's powers.
The years went on, and one day, due to the school's scheduled visit to the prison, Shiro found out that Ganta was living in the city and where he studied. She ran away from the laboratory to find Ganta.
She ends up killing all Ganta's classmantes for jealousy, and inserts the power to null her powers into Ganta, hoping he will then become her hero and save her, by killing her. She wanted to be killed by the boy she loved.