As Avram travels through Eretz Yisrael for the first time, we are told והכנעני אז בארץ (בראשית יב:ו), "The Canaanite person/nation was then in the land." (Whether this pasuk is in singular or plural form is not completely clear.) Rashi (שם) explains that the land originally belonged to Shem, son of Noach. Canaan, Noach's grandson through Cham, had conquered the land unfairly from Shem. The Torah thus tells us that Canaan was then in the land, meaning that Canaan had come in via an illegal conquest, and he would be deported by descendants of Shem (Bnei Yisrael) when the time would be right, returning the land to its proper owner. This is difficult, however, because the Torah states in last week's parsha, ויהי גבול הכנעני מצידון באכה גררה עד עזה באכה סדמה ועמורה ואדמה וצבויים עד לשע, (בראשית י:יט) that the borders of Canaan included Tzidon, Gerar, Sedom, Amora, Adma, Tzevoyim, and Lasha, which seems to imply rather unequivocally that at least part of Eretz Yisrael was in the borders given to Canaan. In fact, Rashi himself, commenting in the pasuk of וחברון שבע שנים נבנתה לפני צען מצרים (במדבר יג:כב), states that Cham built the city of Chevron for his son Canaan. It does not appear from this Rashi that Canaan took the land through illegal conquest, as Rashi mentioned earlier. Rather, his father had the land and gave it to him. Rashi appears to be contradicting himself.
To make matters more complicated, the Ibn Ezra has a rather unusual comment on this topic. On the pasuk in בראשית יב:ו, he states, יתכן שארץ כנען תפשה כנען מיד אחר, ואם איננו כן יש לו סוד והמשכיל ידום. "It is possible that Eretz Canaan was taken (forcibly) by Canaan. If not, this has a deep secret, and the enlightened should remain silent." Apparently, Ibn Ezra believed that the simplest understanding of the פסוקים was that Eretz Yisrael was always meant for Bnei Yisrael, but that there was some deeper (perhaps Kabbalistic) reason why Eretz Yisrael started in Canaanite hands.
Rabbi Eliyahu Mizrachi answers the previously mentioned contradiction in Rashi by stating that Rashi himself was in no way responsible for the contradiction. Rashi usually quotes other midrashim in his commentary. In this case, the midrash which Rashi quoted in בראשית and the midrash which he quoted in במדבר were contradictory, but Rashi in no way contradicted himself. This answer of R. Mizrachi indicates that it was not merely an issue in the time of Rashi and Ibn Ezra about who originally was given Israel. Since the time of earlier midrashic commentators, there had been this disagreement. Further, there were midrashic commentators on both sides of the discussion. As midrashic commentators are not necessarily bound by literal meanings of פסוקים, the two opinions are undoubtedly not just two understandings of certain textual issues. They are two different understandings of the relationship between Hashem, His land, and His people. This being the case, it is not difficult to understand the position that Eretz Yisrael was always destined for the Jewish people. However, according to the other view, why would Hashem give Eretz Yisrael to Canaan initially? Did He forget that He was planning on giving it to Bnei Yisrael? The Ibn Ezra truly was not exaggerating when he said that this understanding was a deep secret!
The Ramban בראשית י:יט() gives a possible answer. The Ramban says that Eretz Yisrael was always meant for Bnei Yisrael. However, Hashem gave it to Canaan to guard for the Jews until they were ready to take it. He compares it to having a slave guard over property until the young heir of the property gets old enough to care for it himself. So too, Hashem had Canaan (whom Noach calls a slave in בראשית ט:כה) guard Eretz Yisrael until Bnei Yisrael were prepared to inherit it.
There is a great lesson in the Ramban's answer. We only have a right to Eretz Yisrael when we act in a way that merits it. If not, Hashem will give it to some other nation to hold until we improve our behavior. Even those who follow the Ramban admit that Hashem meant Israel for us; it's up to us to be worthy of claiming it.