The building -- which had not been authorized to operate as an orphanage since 2013 -- housed about 66 children, said magistrate Raymonde Jean Antoine.
The fire in Kenscoff -- a town of 50,000 south of the capital -- began shortly after 9:00 pm Thursday (0200 GMT Friday), she said.
Two children died in the blaze and 13 others died at a hospital as a result of smoke inhalation, said Judge Antoine.
According to one of the children, the fire was ignited by candles that the children had lit in their rooms because the electricity was out, she told AFP.
An investigation is underway to determine the exact cause of the fire and identify the people responsible for the orphanage.
Antoine entered the Orphanage of the Church of Bible Understanding Friday morning to report the death of the two victims in the building itself. Their ages have yet to be determined. She also will document the damage caused by the fire.
The two-story building was in a state of complete disrepair, with bunk beds -- some in deplorable condition -- crammed into small rooms, a cramped staircase and only one usable exit door, an AFP reporter saw.
"The children's living conditions are truly, truly neglected: all we see are children living like animals," Antoine said, adding that there were no fire extinguishers to be found.
Only three adults were present at the time of the fire.
"This orphanage does not have permission to run," confirmed Arielle Jeanty Villedrouin, the director of the Haitian office of children's welfare (IBESR).
"It's an organization that, I believe, receives money from the religious sector, foreign missionaries, I don't know exactly, but therefore illegally."
At the start of 2019, IBESR had found that only 35 of the 756 juvenile accommodation centers identified throughout the impoverished country had the necessary operating permits.
In addition to the judicial investigation, the government is working to "recover the surviving children, who are traumatized after the tragedy, and place them with the IBESR's transition center where they will receive psycho-social support," Villedrouin said.
In 2017, Lumos, an NGO founded by the writer JK Rowling of Harry Potter fame to reunite orphanage kids with their parents, reported that at least $70 million are received yearly by just a third of the orphanages in Haiti.
The estimate was produced after the sole analysis of foreign NGOs' budgetary reports, as the accounts of religious missions were not made available.