The blaze occurred in Renens, west of the Vaud capital, in a complex owned by the municipality, according to media reports.
The building, on Rue de Crissier, was destroyed, while the body of the man was found completely burnt to ashes, Vaud cantonal police said in a news release.
A neighbour first noticed the flames at around 6.30pm and contacted emergency services.
More than 30 fire fighters responded with five trucks, in addition to several police patrols from West Lausanne and the local gendarmerie, plus an ambulance crew.
The remains of the man, whose age and nationality were not confirmed, were found in front of a window on the ground floor of the building.
Police launched an investigation into the cause of the fire.
The city of Renens was informed that a storage area in the building was being occupied by a homeless person back in November, 20 Minutes reported online on Monday.
“The man was known to our social workers,” said Marianne Huguenin, mayor of Renens is quoted as saying by the newspaper.
“As it was winter and the social situation was extremely complex, we preferred not to evict him,” Huguenin said.
“Maybe we were wrong.”
Investigators are still in the process of formally identifying the victim.
Meanwhile, they are still looking into the cause of the fire, although a technical incident has been ruled out, cantonal police said.
The building housing the storage area was set to be demolished in March 2015 to make way for a future tram line as part of the Lausanne public transport network, 20 Minutes reported.