The woman, believed to be aged 22, was seriously injured in the early morning crash and was flown to a Stockholm hospital, police spokesman Lars Bystrom said.
No one else was injured.
Bystrom said the woman was arrested on suspicion of endangering the public.
Tomas Hedenius, a spokesman for train operator Arriva, said the woman stole the four-carriage train at a depot outside Stockholm.
Police were investigating how she had gained access to the cabin and how she accessed the key to start the train.
She then drove it about a mile to the end station on the railway line, where it jumped off the tracks, careered for about 30 metres and crashed into a three-storey building.
The train had ploughed past the end of the line and vaulted over a street separating the house from the depot, crashing through a balcony and into a downstairs room in the upscale suburb of Saltsjobaden.
“The cleaner drove the train at high speed, considerably higher than normal on that stretch, to where the rails end and crashed into a house,” said Jesper Pettersson, spokesman at Stockholm Public Transport.
Photographs from the scene showed the crumpled front car of the train buried deep into the structure.
“There were three families inside the apartment building, but no one was injured. At least not physically,” Hedenius said.
The motives of the woman, who worked for a company contracted to carry out cleaning for the train operator, were not immediately clear.
“We have only heard good things about her. We’re investigating how this could happen, and why she did what she did,” Hedenius said.
He said it’s unclear how she got the keys to the train, but added that driving it is not that complicated.
“Generally speaking that’s possible even if you’re not a train driver,” he said.
“You can read about it on the internet, or observe how others do it.”
Mr Pettersson said the incident will result in a major review of the company’s security system.