The legend of Mahakaleshwar relies on numerous theories and myths; they are a number of the common stories. It's believed that when Sati walked into the fireplace to rebel versus her father, Daksha's objection toward her marriage with Shiva, the latter was furious and thus done the Dance of Dying; https://mahakaltimes.com/