There is an interesting story of how Gandiva was acquired by Arjuna. Arjuna helped Lord Agni to cure the indigestion caused by a yagna conducted by King Swetaki.
Lord Agni asked Varuna, who was in possession of Gandiva in exchange of annihilation of Khandava forest. He also gave Lord Krishna the mace Kaumodaki and the discus named Chakrayudha. Varuna also offered Arjuna the bow Gandiva, two inexhaustible quivers, a chariot made by Viswakarma that had Hanuman in its banner, and white steeds that were born in the region of Gandharvas. It was the same chariot in which Soma (Chandra) had earlier vanquished the Danavas.