Because they wanted to return to their home-land. Why else?
Aragorn claims his heart is in the North, and he returns there. (for a time)
Gondor doesn't 'belong to them'. The belong to
Arnor, they had been protecting it for hundreds of years.
Isildur had decreed that he would be high-king over Arnor and Gondor but committed Gondor in the rule of Meneldil and his descendants.
This claim was waived by the Gondorian council after the death of Ondoher. (Earnil, captain of the
ships at Pelargir and Captain of the Southern Host that defeated the
Haradrim at the River Poros) who claimed that Isildur relinquished his claim. In any case, the descendants of Isildur were held by little worth (or scorned, by say
Denethor, though he was the ruler and a proud man.
Boromir had this intrinsic pride when he first talks to Aragorn and is corrected by
Bilbo) though some still remembered them, but Arthedain was of little account to most of the people of Gondor, though Eärnur could not forgot the ties of kinship.
Aragorn was of course accepted as King for several reasons. Gondor wanted a King, (naturally) he had rescued Gondor and led the march to
Mordor, and it was accepted that his claim to be the lawful descendant of Isildur (Or
Elendil) and thus had the right to the kingship. (He was also descended from Ondoher, through his daughter Fíriel, who married Arvedui.) The line of Isildur was accepted as a legitimate claim for kingship, not just the line of Anarion as Denethor, Boromir (on Isildur's actions after the Last Alliance) "before he committed to him (Meneldil) the rule of the
South Kingdom" and the Gondorian council.
The
Rangers belonged in Arnor because it was their homeland, not Gondor.