The fire broke out around 5 p.m. at one of the James Weldon Johnson Homes on the 1900 block of North 25th Street.
Rob Riley, who lives down the block, said he heard a child screaming and immediately ran over to help.
"I tried to open the door to get to the little boy, and it was just too much smoke," Riley said. "An innocent child. We see that boy walking down to the swimming pool every day. It's a shame."
Fire officials said flames and smoke were on the first floor, while the 12-year-old was trapped on the second. Firefighters rescued him, but he was later pronounced dead at the hospital.
"All personnel on scene - fire, EMS, and police - did everything they could and acted within the highest traditions of the fire department and the police department," said Assistant Fire Chief Anthony Bompadre.
Officials said at least two other children were inside the home at the time. Both are expected to be OK.
Back in the neighborhood, many are thinking about the family, including first responders who have built relationships in the community.
"For our men and women to respond to this and see something so tragic, it's something that really cuts to the heart of what we do as first responders," said Philadelphia Police Captain Michael Goodson. "From the proverbial ashes, we'll continue to do what we have to do to uplift this community and support this family. It's a tragedy for this community."
The cause of the fire remains under investigation.