At the time of exile of Pandavas in the Mahabharata epic, they stayed at Masroor for some duration, in which for worship they started building this temple, but due to Kauravas invasion, Pandavas have to leave the temple in an incomplete condition