The story of Kedarnath began with Pandavas. After the grotty war of Mahabharata, Pandavas along with Draupadi were looking for penance for killing their own kins. They were highly guilty of their sins and were asking for forgiveness from Lord Shiva who resided in the Himalayas.
However, Lord Shiva was not willing to forgive them. Hence, he disguised himself as a bull so that no one would recognize him.
But one day, Bhima (one of the five Pandavas) saw a bull grazing near the Guptakashi and immediately identified it to be Lord Shiva. He hurriedly ran to get a hold of the bull by its tail and hind legs. But to his disappointment, the bull soon disappeared in the ground and reappeared in five different forms with the hump appearing in Kedarnath, the arms in Tungnath, the face in Rudranath, the nabhi (navel) and stomach in Madhyamaheshwar and hair in Kalpeshwar.
Later upon, pleased by the reappearance of Lord Shiva, the Pandavas built temples in all the five places where the instances of Lord Shiva were found. These places together form the Panch Kedar.