Wikipedia on what might have been a gunpowder explosion, or maybe a meteor:
The sky was clear, but suddenly a loud "roaring" rumble was heard coming from northeast, gradually reaching southwest of the city, followed by dust clouds and shaking of houses. Then a bright streak of flash containing a "great light" followed and a huge bang that "shattered the sky and crumbled the earth" occurred, the sky turned dark, and everything within the 3–4 li (about 2 km or 1.2 miles) vicinity and a 13 square li (about 4 km2 or 1.5 mi2) area was utterly obliterated.
The late Ming dynasty was already suffering domestic crisis from political corruption, factional conflicts, and repeated natural disasters (alleged by some historians to be due to the Little Ice Age) leading to peasant riots and rebellions, which also happened elsewhere globally as part of the General Crisis. However, the horror of the Wanggongchang Explosion dwarfed all of those, and the imperial courts criticized the Tianqi Emperor and believed that the incident was a punishment from Heaven as a warning to correct the sins of the emperor's personal incompetence.