לֹ֣א בְצִדְקָתְךָ֗ וּבְיֹ֙שֶׁר֙ לְבָ֣בְךָ֔ אַתָּ֥ה בָ֖א לָרֶ֣שֶׁת אֶת־אַרְצָ֑ם כִּ֞י בְּרִשְׁעַ֣ת ׀ הַגּוֹיִ֣ם הָאֵ֗לֶּה יְהוָ֤ה אֱלֹהֶ֙יךָ֙ מוֹרִישָׁ֣ם מִפָּנֶ֔יךָ וּלְמַ֜עַן הָקִ֣ים אֶת־הַדָּבָ֗ר אֲשֶׁ֨ר נִשְׁבַּ֤ע יְהוָה֙ לַאֲבֹתֶ֔יךָ לְאַבְרָהָ֥ם לְיִצְחָ֖ק וּֽלְיַעֲקֹֽב׃
你進去得他們的地為業,並不是因為你的義,也不是因為你心裡正直,而是因為這些國民的邪惡,永恆者你的上帝才把他們從你面前趕出,也是為要成就永恆者向你列祖亞伯拉罕、以撒、雅各所起的誓。
Rashi
לא בצדקתך אתה בא לרשת … כי ברשעת הגוים NOT FOR THY RIGHTEOUSNESS … DOST THOU GO TO POSSESS [THEIR LAND], but (כי) for the wickedness of these nations. — Here you have the word כי used in the sense of "but".
Ramban
AND THAT HE MAY ESTABLISH THE WORD WHICH THE ETERNAL SWORE UNTO THY FATHERS. The purport thereof124Since the merits of that generation were not sufficient to bring them victory, the question arises, “Why could not the entry into the Land be delayed for a worthier generation?” Ramban suggests that the verse before us gives an answer to this question. is that He had said and they shall serve them; and they shall afflict them four hundred years.125Genesis 15:13. And in the fourth generation they shall come back hither.126Ibid., Verse 16. Therefore it could not be postponed to a later generation.
Rashbam
לא בצדקתך וביושר לבבך, definitely not on account of your righteousness and your upright hearts. For I want you to remember 'זכור אל תשכח את אשר הקצפת וגו, and not forget how you have angered G’d, etc. However, one of the two factors you cited is correct, namely the wickedness of these nations. The reason that you replaced them (and not someone else) is למען הקים לך את השבועה, in order to fulfill by means of you the oath G’d swore to your forefathers.