Jyotirlinga is the sacred form of Lord Shiva and there are twelve such Jyotirlingas in India. There is a Jyotirlinga in Ujjain, where Lord Shiva is being worshipped as Mahakaleshwar. Ujjain is located in Madhya Pradesh.
As per the epics like Shiva Purana and Linga Purana, once upon a time in ancient India, there lived a Brahmin in place called Avanti. The Brahmin had four sons and all of them were great devotees of Lord Shiva. In the same era, there lived a demon called Dushanan.
As the other demons in the history, he was troubling and disturbing all the good and religious activities performed by sages, Brahmins and other Pujaris in the temples. To end up the disturbances caused by Along with the four sons, the Brahmins had assembled from all over and performed the special Poojas to Lord Shiva. The Shiva Linga used by them was made of mud and the spot where they had taken mud to make the Lingam, had become a huge pond.
By knowing the fact that people were performing special attempts to end his existence, enraged demon Dushanan arrived to the pond along with his mighty forces and started disturbing their pooja. It is believed that Lord Shiva himself had emerged from this pond as Mahakaleshwarar and destroyed the demon Dushanan, thus saving the Brahmins from his tyranny.
On the request of the brahmins, Lord Shiva had given Darshan to his devotees at this spot sthalam, which had become one of the Jyotir Linga sthalams. It is said that all the villagers had also contributed for the construction of Mahakaleshwara temple.