The movies had to simplify the history a lot, because it would take a while to explain. Here's a crash course in the history of Middle Earth.
Before the sun & moon - a lot of Elves sailed west across the ocean to the Undying Lands, Valinor
First Age - catastrophe happens in Valinor, 3 great treasures of the Elves in Valinor are stolen by an enemy far more powerful than Sauron, and the Elves of Valinor come back to Middle-earth to fight him. During that time the first Men arrive in the western areas of Middle-earth. The Elves name them Edain. The bravest and best of them fight with the Elves against the Enemy. After their victory, the Edain are given a special island out in the ocean, halfway between Middle-earth and the Undying Lands, for their own. Their first king is Elrond’s brother Elros, who is half-Elven, but chooses mortality. The name of this island is Númenor or Westernesse, in the common tongue, since it lies west of Middle-earth.
Second Age- Númenor prospers for a long time. Its people are wise and powerful, tutored by the Elves, and have a longer lifespan than ordinary humans. Unfortunately they grow jealous of the Elves and resent the fact that they are still not immortal. Eventually they rebel against the gods and try to sail to the Undying Lands. In punishment for this, Númenor is sunk, and the only survivors are the family and followers of Elendil, who remained friendly with the Elves and didn’t rebel, plus some Men who had come back to Middle-earth. (Elendil is distantly related to the king's family and a descendant of Elros).
Elendil and his family return to Middle-earth and set up two kingdoms-- Arnor west of the Misty Mountains, and Gondor east of the Misty Mountains but west of Mordor. All the Men of these kingdoms are called Númenoreans or, in Elvish, Dúnedain, "Men of the West". They retain longer lifespans than normal Men and keep alive the knowledge of the Elves.
They join forces with Gil-galad and the Elves of Middle-earth to defeat Sauron. Elendil is killed. His older son, Anárion, is also killed. Isildur tutors Anárion’s son Meneldil, helps him become king of Gondor, plants the White Tree of Minas Tirith in memory of his brother, and after a few years heads back to his own kingdom in Arnor. On the way his company is ambushed by orcs, and Isildur is killed. His youngest son, Valandil, had stayed behind in Rivendell because he was too young to fight, and the boy becomes the next king of Arnor.
Third Age- Arnor and Gondor have peace for a while, but Arnor gets divided up among various heirs and weakened, finally defeated by the witch-king of Angmar (the lord of the Nazgûl). The son of the last king survives the war, but his people are scattered, the kingdom destroyed, so the last of the Dúnedain of Arnor remain in hiding in the wilderness west of the Misty Mountains and become what are known as the Rangers. Elrond lets them use Rivendell as a safe haven. Gondor is under attack by various dark forces too (no one realizes until later Sauron is arising again) and eventually it loses its kings too; the Steward of the last king of Gondor takes up custody of Gondor “until the king shall come again.”
Here’s the tricky bit, and the reason why Jackson really glossed this over in the films: shortly before the last king of Arnor, the king of Gondor died without a surviving son. The king of Arnor had married his daughter, and suggested the two kingdoms should be reunited, since his son was the grandson of the last king of Gondor. But the nobles of Gondor said no, we don't allow inheritance through daughters, and Gondor is ruled by descendants of Anárion NOT Isildur. They picked somebody who was a more distant relative of their last king. A few generations later, the family died out and no heirs could be found.
That means that Aragorn’s family was told they couldn’t inherit the throne of Gondor... even though the founder of their line, Isildur, was brother of the king of Gondor. Aragorn was therefore only the chief of the Rangers, the Dúnedain of the North (as they were called), and he had to get that ancient ruling overturned to win the throne of Gondor and reunite the kingdoms. Defeating Sauron convinced Gondor to accept him as king.
In sum: The Dúnedain, the Men of the West, were men who long ago helped the Elves against their enemies. Their first king was Elrond’s brother Elros, and they were gifted with long lives and the wisdom and training of the Elves. Over long ages their race declined and their kingdoms fell. Aragorn was a descendent of the old royal line.