A fire was reported around 4:30 a.m. at the building near Leland Avenue and Bayshore Boulevard near the Bayshore Caltrain station, fire spokeswoman Mindy Talmadge said.
Once firefighters responded to the blaze the building was engulfed in flames and had burnt to the ground, she said.
Crews doused the destroyed structure in water and later that morning while Caltrain workers were clearing debris from the fire they discovered a body, Talmadge said.
Police said the discovery was made around 10:30 a.m. while workers were repairing a fence in the area.
The cause of death is under investigation and is not being ruled a homicide, police said.
Talmadge said it is not clear if the person died in the blaze or had died before the fire broke out.
She said about a week ago another outbuilding was burned in the area. No one was injured in that incident.
An arson investigation is underway, she said.
There is evidence of squatters hanging around the area with grocery carts, papers and other items left behind, Talmadge said.
The San Francisco medical examiner's office said the body has not yet been identified.