Kedarnath is situated in the Himalayas

Nara and Narayan,  the two incarnations of Lord Vishnu  did penance at  Badrikashram. Lord Shiva asked them for a boon. They requested Him to remain there for ever.

Thus, Lord Shiva established himself as Kedarnath Jyotirlinga.

Another legend says that the  Pandavas were perplexed after the battle of Kurushetra, for having killed their own cousins the Kauravas. So, in order to absolve their sins they worshipped Lord Shiva who resided in the snow capped Himalayas. But, Lord Shiva did not want to forgive them of their sins so easily, he took the  form of a buffalo. The place where Lord Shiva took the form of a buffalo is known as Guptkashi. Nakula and Sahadeva first spotted the unique looking buffalo. Bhima picked up the buffalo by his tail and banged him on the floor, the parts of the buffalo scattered on the earth, the hump at Kedar, the hair at Kalpeshwar, face at Rudranath, the arms at Tunganath and the navel at Madhyamaheshwar. All the five places together is known as “Panch Kedar.”

Lord Shiva then appeared before the Pandavas and established himself at Kedarnath