Vyasa is one of the 7 chiranjeevis or immortals. He is considered to be the author of Mahabharata. How did he become immortal?
It's due to the boon from Deva-Adi-Deva Mahadeva.
"'Parasara said,—"In former times I gratified Sarva, O king. I then cherished the desire of obtaining a son that would be possessed of great ascetic merit, endued with superior energy, and addressed to high Yoga, that would earn world-wide fame, arrange the Vedas, and become the home of prosperity, that would be devoted to the Vedas and the Brahmanas and be distinguished for compassion. Even such a son was desired by me from Maheswara. Knowing that this was the wish of my heart, that foremost of Deities said unto me,—'Through the fruition of that object of thine which thou wishest to obtain from me, thou shalt have a son of the name of Krishna. In that creation which shall be known after the name of Savarni-Manu, that son of thine shall be reckoned among the seven Rishis. He shall arrange the Vedas, and be the propagator of Kuru's race. He shall, besides, be the author of the ancient histories and do good to the universe. Endued with severe penances, he shall, again, be the dear friend of Sakra. Freed from diseases of every kind, that son of thine, O Parasara, shall besides, be immortal.'—Having said these words, the great Deity disappeared there and then. Even such is the good, O Yudhishthira, that I have obtained from that indestructible and immutable God, endued with the highest penances and supreme energy." (MBH. 13-49-45).
I hope this clarifies all your queries. Prd..