The F-7 BGI jet took off at 1.06pm from the Bangladesh Air Force base in Kurmitola, Dhaka as part of a routine training mission but encountered a mechanical failure, spokesman Lieutenant Colonel Sami Ud Dowla Chowdhury said.
"The pilot ... made a valiant attempt to divert the aircraft away from densely populated areas. Despite his best efforts, the aircraft ... crashed into a two-storey building belonging to Milestone School and College," he said.
The pilot was among those killed in the incident, the military said, adding that a committee had been formed to investigate its cause.
The F-7  BGI is the final and most advanced variant in the Chinese Chengdu J-7/F-7 aircraft family, according to Jane's Information Group.
Bangladesh signed a contract for 16 aircraft in 2011 and deliveries were completed by 2013.
The Chengdu F-7 is the licence-built version of the Soviet MiG-21.
Videos of the aftermath of the crash showed a big fire near a lawn emitting a thick plume of smoke into the sky as crowds watched from a distance.
Firefighters sprayed water on the mangled remains of the plane, which appeared to have rammed into the side of a building, damaging iron grills and creating a gaping hole in the structure, footage filmed by Reuters showed.
"A third-grade student was brought in dead, and three others, aged 12, 14 and 40, were admitted to the hospital," Bidhan Sarker, head of the burn unit at the Dhaka Medical College and Hospital, said.
Images from the scene also showed people screaming and crying as others tried to comfort them.
"When I was picking (up) my kids and went to the gate, I realised something came from behind ... I heard an explosion. When I looked back, I only saw fire and smoke," said Masud Tarik, a teacher at the school.