But, Shiva assumed the form of a Nandi and hid in the Garhwal region to avoid Pandavas as he was deeply hurted by Mahabharata War.
Pandvas saw a bull grazing near Guptakashi while searching for Shiva. Bhima immediately recognized the bull to be Shiva. Bhima caught hold of the bull by its tail and hind legs. But the bull-formed Shiva disappeared into the ground to later reappear in parts, with the hump raising in Kedarnath, the arms appearing in Tunganath, the nabhi and stomach surfacing in Madhyamaheshwar, the face showing up at Rudranath and the hair and the head appearing in Kalpeshwar.
The Pandavas pleased with this reappearance in five different forms, built temples at the five places for venerating and worshipping Shiva. The Pandavas were thus freed from their sins. It is also believed that the fore portions of Shiva appeared at Pashupatinath, Kathmandu – the capital of Nepal. After building the Panch Kedar temples, the Pandavas mediated at Kedarnath for salvation, performed yagna and then through the heavenly path called the Mahapanth attained heaven or salvation.