Aurangzeb banned musical instruments when he became emperor. The very next morning he heard a nagada drum. He was told that a Jain officer in the Mughal army kept a statue of a Tirthankar in his tent, and that during his morning prayers drums sounded on their own, with nobody beating them.
Aurangzeb visited the tent, saw it for himself, and allowed the worship to continue. Over time the tent and the area around it became today's temple.

