"Ailing" is a present participle, "planet" a noun.
Together they form a phrase that's personification, likening something that isn't human to people.
It's a metaphor. Since a planet cannot be ailing (unwell) in the true sense of the word.
ailing is an adjective, describing the noun, planet.