If the gods are reluctant to give the vardan or boon of amaratva (immortality) then why are certain personalities like Ashwasthhama and other chiranjivis immortal?
Those who are born are certain to die. Only beginningless doesn't have end for the obvious reasons.
BG 2.27 - Those who have a birth, it's certain [for them] to die, Hence you don't have to grieve about inevitable
Ashwathama, shri Hanuman & all others are born with certain attributes. Though they are Chiranjivi(long lived), they are not immortal from their physical body perspective. However should [any of] they, become indifferent to various qualities & tastes of prakruti, their subtle bodies would surely identify/unify with the Brahman, which is beginningless & hence immortal.
BG 2.15 - O foremost of men, surely all these don't distress to that person(Purusha); that wise person to whom sorrow and happhiness are the same -- is fit for immortality.
It all depends on how you gratify the god. Yes, some people are born with divine attributes like Vyasa in the down text and Hanuman also but it is their understanding and thinking.
For Vyasa to be born, Parashara did a penance to Shiva and Shiva said that he will be immortal so he was immortal since birth. Parasara just wanted a son with great ascetic merit, hat 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 but Shiva was so gratified that he even gave Parasara a boon that he will be the Saptarshi of Savarni Manvantara, be immortal by being freed of diseases. So, vyasa was born with divine attributes.
The reason Shiva got impressed is that Parashara asked that his son be devoted to vedas and brahmanas and be distinguished for compassion. This should also explain why Vyasa is immortal.
"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.
Some people became immortal because of their good behavior like Vibhishana.
Brahma then addressed Vibhishana, 'O my son, I am much pleased with thee! Ask any boon thou pleasest!' Thereupon, Vibhishana replied, 'Even in great danger, may I never swerve from the path of righteousness, and though ignorant, may I, O adorable Sire, be illumined with the light of divine knowledge!'
Brahma was so impressed that he granted him immortality.
And Brahma replied, 'O scourge of thy enemies, as thy soul inclines not to unrighteousness although born in the Rakshasa race, I grant thee immortality!'
Vibhishana became immortal but again, the same Ravana who was the brother of Vibhishna could not become immortal.
Before Ravana could even ask for anything, he said, ask anything except immortality.
And at the close of a thousand years, the invincible Ten-headed One, cutting off his own heads, offered them as offering to the sacred fire. And at this act of his, the Lord of the Universe was pleased with him. And then Brahma, personally appearing to them, bade them desist from those austerities and promised to grant boons unto every one of them. And the adorable Brahma said, I am pleased with you, my sons! Cease now from these austerities and ask boons of me! Whatever your desires may be, they, with the single exception of that of immortality, will be fulfilled! As thou hast offered thy heads to the fire from great ambition, they will again adorn thy body as before, according to thy desire. And thy body will not be disfigured and thou shall be able to assume any form according to thy desire and become the conqueror of thy foes in battle.
You might wonder why but look at what he asked.
There is no doubt of this!' thereupon Ravana said, 'May I never experience defeat at the hands of Gandharvas, Celestials, Kinnaras, Asuras, Yakshas, Rakshasas, Serpents and all other creatures!' Brahma said, 'From those that hast named, thou shalt never have cause of fear; except from men (thou shalt have no occasion for fear). Good betide thee! So hath it been ordained by me!'>
There is nothing wrong in asking those boons as long as your intention is good but Why did Ravana did not say men? Did he forget that he did not include men? If he said men, then a man would not have killed him but why did he not say men? Did he forget?
"Markandeya said, 'Thus addressed, the Ten-headed (Ravana) was highly gratified, for on account of his perverted understanding, the man-eating one slightened human beings.
No! It was because of his perverted understanding. He thought that men were not very strong.
Vibhishana asked a boon for itself that he be always righteous and was not arrogant and completely surrendered to the god. If he wanted, he could have thought about getting same boons like Ravana and not get the boon to be righteous all the time and it is the very quality of Vibhishana that impressed Brahma so much despite the fact that he is a Rakshasha.
People who sinned also made gods very happy such as Parashurama who sinned of killing Brahmanas, that too his own brothers but it was his understanding that he had sinned and to purify himself made Shiva gratify.
Then Jamadagni's son, that foremost of all righteous persons, shining like the Sun with blazing splendour in the midst of that conclave of Rishis, said unto the son of Kunti these words;--I was afflicted with the sin, O eldest son of Pandu, of Brahmanicide for having slain my brothers who were all learned Brahmanas. For purifying myself, I sought the protection, O king, of Mahadeva. I hymned the praises of the great Deity by reciting his names. At this, Bhava became gratified with me and gave me a battle-axe and many other celestial weapons. And he said unto me,--Thou shalt be freed from sin and thou shalt be invincible in battle; Death himself shall not succeed in overcoming thee for thou shalt be freed from disease.
Rishi Asita Devala got cursed by Indra which made him lose his merit but it was his thinking that made him gratify Shiva and Shiva gave him all he wanted and also made him have great fame and long life.
Then the Rishi Asita-Devala, addressing the royal son of Pandu, said,--In former days, O son of Kunti, through the curse of Sakra, all my merit due to the acts of righteousness I had performed, was destroyed. The puissant Mahadeva it was who kindly gave me back that merit together with great fame and a long life.
There are some who were born with divine attributes.
Ashwathama was born a portion of Rudra, Yama, Kama, and Krodha which can be the reason why he is immortal.
And, O king, his son the heroic Aswatthaman, of eyes like the lotus-petals, gifted with surpassing energy, and the terror of all foes, the great oppressor of all enemies, was born on earth, of the united portions of Mahadeva, Yama, Kama, and Krodha.
Divine attributes from birth do play a role but It is ALSO in your way of thinking and understanding and of course, Dharma, a key factor.
Sometimes, you have good understanding because of your divine birth like Vyasa. Shiva told him that he will have great ascetic merit, freed from diseases, being immortal and gave Parasara a boon that his son will be the author of ancient histories. So Vyasa had divine birth and good thinking.
There are people like Vyasa and Hanuman who had divine birth and have righteous understanding because of which they immortal
There are people like Vibhishana who became immortal because of their pious behavior and righteous understanding and did penance just to be righteous. Even people who have sinned also became immortal because they realized that they have sinned.
Also, if Shiva is gratified, he can even bestow immortality. That is also the reason why Ashwathama was able to slaughter many soldiers of the Pandava army because he gratified Shiva.
The holy one said, "Verily, Drona's son had sought the aid of that highest of all the gods, the eternal Mahadeva. It was for this that he succeeded in slaying, single-handed, so large a number of warriors. If Mahadeva be gratified, he can bestow even immortality. Girisha can give such valour as will succeed in checking Indra himself. I know Mahadeva truly, O bull of Bharata's race! I know also his various acts of old. He, O Bharata, is the beginning, the middle, and the end of all creatures. This entire universe acts and moves through his energy.
Hanuman's immortality is a combination of multiple boons. First of all, as [described] in the Kishkindha Kanda of the Ramayana, when Hanuman was a child, he wanted to eat the sun thinking it to be a fruit which made Indra attack him with his Vajra and at this, Vayu became furious and refused to give air to the universe.
Then on observing that you are mutilated, highly infuriated is that scent-wafter Air-god and that tempestuous Air-god has not physically circulated throughout the triad of worlds. When the triad of worlds is being roiled with breathlessness, all the administrative gods of universe are bewildered, and they started to supplicate the Air-god for his grace. Oh, chivalric warrior at war, while the Air-god is being supplicated, oh, dear boy, Brahma gave you a boon decreeing your "indestructibility by any missile." On scrutinising that you are unhurt even after hit by Thunderbolt, oh, ablest Hanuma, the Thousand-eyed Indra kind-heartedly gave you a choicest boon saying that your death occurs only by your own volition.
So the boons of Brahma and Indra made him immortal and also, he was Vayu's son.