Swedish police discovered that one of the two workers at Andersson's home had been ordered to deport from the country.
Anderson, who has been prime minister since November 2021, said she had terminated all contracts with the cleaning company.
Speaking to Swedish newspaper Expressen, Andersson said: "Even those who are careful to adhere to proper procedures can fall into the trap of dodgy operators."
Andersen says she will work to make Sweden a global role model, adding that she has been assured by the head of the cleaning company that all of the company's employees work legally.
The Naka home is the home of the Andersson family, who had moved to the Prime Minister's Residence in Stockholm before the incident.
The cleaner in question is believed to be a woman in her twenties from Nicaragua, who was handed over to the Swedish Migration Agency.
The accident occurred on December 21, 2021, but it was not reported by the media in Sweden until last Saturday.
Magdalena Andersson is the leader of the Social Democratic Party and the first woman to hold the position of Prime Minister in Sweden, and Andersson focused in her election campaign on combating the illegal economy.
In her inaugural address, Andersen called on Swedes to take personal responsibility for tackling organized crime in the country, calling it the shameful organized side of the economy.
Anderson said in her press statement that this incident highlights a problem she has always referred to, and that there is more.
And political opponents in the country have raised questions about Anderson's security measures, proposing to strengthen control over who can enter the prime minister's home.
On Twitter, an MP from Sweden's opposition moderate Rally party tweeted that former UK immigration minister Mark Harper had resigned in 2014 after discovering he had hired a cleaner who did not have the right to work in the UK.
It is not clear whether the cleaner was at the Swedish Prime Minister's home at the time the police arrived at the scene.
The owner of the cleaning company told Swedish TV that the aforementioned woman was not charged with cleaning the house, but was actually in a car outside the house.