Mahārāja Khaṭvāṅga is mentioned herein as a saintly king because even within the responsibility of the state management, he was not at all forgetful of the prime duty of life. Such was the case with other rājarṣis (saintly kings), like Mahārāja Yudhiṣṭhira and Mahārāja Parīkṣit. They were all exemplary personalities on account of their being alert in discharging their prime duty. Mahārāja Khaṭvāṅga was invited by the demigods in the higher planets to fight demons, and as a king, he fought the battles to the full satisfaction of the demigods.
The demigods, being fully satisfied with him, wanted to give him some benediction for material enjoyment, but Mahārāja Khaṭvāṅga, being very much alert to his prime duty, inquired from the demigods about his remaining duration of life. This means that he was not as anxious to accumulate some material benediction from the demigods as he was to prepare himself for the next life. He was informed by the demigods, however, that his life would last only a moment longer. The king at once left the heavenly kingdom, which is always full of material enjoyment of the highest standard, and coming down to this earth, took ultimate shelter of the all-safe Personality of Godhead. He was successful in his great attempt and achieved liberation. This attempt, even for a moment, by the saintly king, was successful because he was always alert to his prime duty.
Mahārāja Parīkṣit was thus encouraged by the great Śukadeva Gosvāmī, even though he had only seven days left in his life to execute the prime duty of hearing the glories of the Lord in the form of Śrīmad-Bhāgavatam. By the will of the Lord, Mahārāja Parīkṣit instantly met the great Śukadeva Gosvāmī, and thus the great treasure of spiritual success left by him is nicely mentioned in the Śrīmad-Bhāgavatam.
Ref >> Srila Prabhupada Vani.