According to the Hindu Mythology, After the Kurukshetra war, Pandavas searched for Lord Shiva to absolve themselves of the sins of killing their family.
Lord Shiva, infuriated by the dishonesty and the destruction caused during the war, disguised himself as a bull and disappeared into the ground with his body parts appearing in five places.
Lord Shiva is worshipped in the form of navel-shaped lingum in Madhyamaheshwar Temple. This temple was built by the Bhima, the second born of the Pandavas. There is also a small temple where the idol of Saraswati made of marble is installed in the sanctum.

Image Credit: Bodhisattwa for Wikimedia Commons
Madhyamaheshwar is a Lord Shiva temple that is the fourth temple on the Panch Kedar pilgrimage circuit. The other temples in the circuit include Kedarnath, Tungnath, Rudranath, and Kalpeshwar.
As per the Indian epic Mahabharata, Pandavas were seeking Lord Shiva to achieve salvation after the bloodshed of the Kurukshetra war.
The vexed Shiva was trying to evade the Pandavas while taking the form of a bull or Nandi. However, the strong-willed Pandavas sighted Shiva in the hills of Guptakashi and tried to forcibly hold him through his tail and legs. But the bull vanished and Lord Shiva reappeared in different parts at 5 separate places in Garhwal Region.
The hump was raised in Kedarnath, arms appeared in Tungnath, stomach and navel came up at Madmaheshwar, a face emerged at Rudranath, and lastly, head and hair appeared in Kalpeshwar. Pandavas then built temples at these five Kedars and attained salvation with the blessings of Lord Shiva.
.