Arjuna received this weapon (Astra), Pashupatastra, twice from Shiva.
The first time: On the Indrakila mountain. Arjuna went to the Himalayas to ask Shiva for this weapon. He shot a boar (it was the demon Muka). Thereupon a hunter appeared who claimed to have hit the boar first and therefore it belonged to him. A dispute broke out until Arjuna realized that the hunter was Shiva. Shiva presented Pashupata to Arjuna. (In Kerala the story goes on.)
Then other Gods appeared, who also handed Arjuna weapons.
Yama – Dandastra, Club, Danda.
Varuna – Pasastra, Loop, Pasa.
Kubera – Antardhanastra, Antardhana. The weapon makes you invisible.
The second time: On the 14th day of the Kurukshetra war he had a dream. He and Krishna went to Shiva and asked for the weapon. Shiva led them to a pond. There they met two snakes that turned into bow and arrow.
Read about more weapons.
Read the story about Pashupata here