Pashupatinath is the guardian spirit and the holiest of all Shiva shrines in Nepal. Pashupatinath Temple is One Part of among one of Dwadash Jyotirlinga of Kedarnath Jyotirlinga Temple.
In Chapter 11, titled as ‘Pashupatinath Linga’, of “Koti Rudra Samhita” in Shiva Purana, Pashupatinath has been described as:
नयपालाख्यां तु प्रसिद्धायां महितले ।
लिङ्ग पशुपतिशाख्यं सर्वकामफलप्रदम् ।।
शिरोभागस्वरुपेण शिवलिङ्गं तदस्ति हि ।
तत्कथां वर्णयिष्यामि केदारेश्वरवर्णने ।।
This translates to:
In Nepal, a Linga by the name of Pashupati has been established and has the capacity to fulfill all desires. This linga has the form of the head, and the story of this linga shall be narrated along with the greatness of Kedareshwara.
The story that is linked to the mentioned “greatness of Kedareshwara” is the chapter 9 of Koti Rudra Samhita:
तद्दिनं हि समारभ्य केदारेश्वर एव च ।
पूजितो येन भक्त्या वै दुःख स्वपनेऽपि दुर्लभम् ।।
यो वै हि पाण्डवान्दृष्ट्वा माहिषं रुपमास्थित ।
मायामास्थाय तत्रैव पालायनपरोऽभवत् ।।
धृतश्च पाण्डवैस्तत्र ह्यवाङ्मुखतया स्थित ।
पुच्छं चैव धृतं तैस्तु प्रर्थितश्च पुनः पुनः ।।
तद्रुपेण स्थितस्तत्र भक्तवत्सलनामभाक् ।
नयपाले शिरोभागो गतस्द्रुपतः स्थितः ।।
This translates to:
Anyone who had adored and given into Kedara Shiva in the past has never been subject to any kind of suffering or grief, even in the dreams. When Pandavas saw him, he took the form of a buffalo using his powers and tried to run away. While he was doing so, Pandavas caught the tail, and the transformed buffalo stood there with the head to the ground. The Pandavas prayed to him over and over again, and so, Shiva established himself there. The head portion appeared in Nepal.
One of the most special features of the Shivalinga in Pashupatinath, Nepal, is that the linga has five head: the east facing Tatpurusha, the north facing Ardhanarishwara (Vamadeva), the west facing Sadyojata, South facing Aghora, and the upward facing Nirakara.
For those wondering what really happened in the story between Pandavas and Shiva that links Kedarnath and Pashupatinath, here is the detailed version of the story:
In the epic war of Mahabharata, the Pandavas defeated their cousins by killing them. In their minds, they had committed gotra hatya, also known as fratricide, and Brahmanahatya (the killing of priest class Brahmans). They wanted to repent for their sins. To continue on their path of atonement, they gave up their reigns of their kingdom their kins and went to Shiva for his blessings. At first, they went to Kashi, or also known as Varanasi, which is supposed to be the favorite city of Shiva and is famous for its Shiva temple. However, Shiva had been deeply enraged by the dishonesty and death in the war of Mahabharata. So, their prayers had no effect on Shiva as he was insensitive to it. He even transformed himself into a bull and hid in the Garhwal region. The search for Shiva in Kashi, thus, went in vain.
The Pandavas then went to Garhwal Himalayas. Bhima standing between two mountains started to look for Shiva when he found a bull grazing near Guptakashi (hidden Kashi). He immediately knew that the bull had to be Shiva, and so he went to the bull and caught the bull by its tail and the legs. But Shiva disappeared into the ground, later reappearing into parts, with the hump in Kedarnath, the arms in Tunganath, the navel and stomach in Madhyamaheshwar, the face in Rudranath, the head in Pashupatinath. Seeing this, Pandavas built temples at five different places to worship and venerate Shiva and so that their sin is forgiven. Having been pleased with their new actions, Shiva granted them their wish and freed them from their sins.
Another version has it that Bhima not only caught the bull but also stopped it from disappearing, which resulted the bull to be torn into five parts and spread across five locations. After that, Pandavas meditated to Kedarnath for salvation, performed yagna and also practiced Mahapanth (known as Swargarohini) to free themselves.