The building in Harburg, south of the port city of Hamburg, housed vulnerable people including 20 refugees, said police in a statement.
They said the cause of the blast remained unclear and that they had no indication so far of a xenophobic attack.
Police were investigating whether the corpse recovered is that of a missing German resident of the building. All other inhabitants were rescued unharmed.
Police said emergency services were alerted around midnight (2300 GMT).
“According to witness accounts, there was an explosion in a building with several inhabitants. The building was already in flames when emergency services arrived,” police said.
Several German shelters for refugees have been hit by attacks in recent months, as anger grows among the far right over a record number of asylum seekers arriving in the country this year.
More than 1,300 far-right offences associated with refugee shelters — including arson, vandalism and online hate speech — were recorded from January to mid-November, up from 482 for all of last year, according to official figures.