In Skanda Purana, Bramha Khand, Sage Vyas told Yudhishtira about how Dharmeshwara Lingam came into existance
Yama DharmaRaja does an Austere Penance
Once, Dharmaraja did an austere penance to please lord Shiva. As usual, Indra became scarred because he thought that Dharmaraj was doing penance with the intention of acquiring Indraloka. He and other deities went to seek the help of lord Brahma, who did not have any clue. So, all of them went to Kailash mountain to seek Lord Shiva’s help. Since Shiva was aware of Dharma’s motive, he explained to the deities that there was nothing to worry about. But, Indra was not satisfied and the thought of loosing his kingdom continued to torment him.
Apsara Vardhini Disturbs The Penance
Indra Instructed an Apsara, Vardhini to go to the place where Dharma was doing penance and disturb him by corrupting his thoughts. Vardhini went to the place where Dharma was engrossed in his penance and was successful in disturbing him. Vardhini asked Dharma the reason behined the penance. Dharma told Vardhini that he was doing penance with the objective of having a divine glimpse of lord Shiva. Vardhini informed him that Indra was scarred of losing his kingdom and hence had sent her to disturb his penance. Dharma was pleased by her truthfulness and wanted to reward her for that. Vardhini expressed her desire of having her abode in Indraloka for eternity . Dharma blessed her after which she returned to Indraloka.
Existance of Dharmeshwara Lingam
Dharma once again engrossed himself in penance. Ultimately, Lord Shiva became pleased and
appeared before him and asked him for a boon. Dharmaraja asked the very place he did penance to be named after him and requested shiva to stay there. Lord Shiva blessed him and fulfilled both his wishes. This was how Dharmakshetra got its name. Subsequently, lord Shiva appeared in the form of Dharmeshwara lingam in accordance with the
second wish of Dharmaraja. After his penance was over, Dharma also had created a holy reservoir over there which is believed to absolve a man of all his sins.