The dormant merit
ויאמר יקוק אל-משה אל-תירא אתו כי בידך נתתי אתו ואת-כל-עמו ואת-ארצו ועשית לו כאשר עשית לסיחן מלך האמרי אשר יושב בחשבון
Hashem said to Moshe: “Do not fear [Og], as I have given him, his entire nation, and his land into your hand. You shall [be able to] do to him as you did to Sichon, the Aramean King, who dwelled in Cheshbon
After forty years in the wilderness, the Jews had begun their final journey towards the land of Israel. They entered the land of Sichon, the King of the Amorites. They successfully conquered his land, and further journeyed towards the land of the Giant Og, King of Bashan. Hashem told Moshe not to fear Og, as their victory was guaranteed. Why was Moshe afraid of Og? There was no reassurance from Hashem before they battled Sichon. It must be that Moshe wasn’t afraid of him, only Og. Rashi brings an explanation from Chazal that Og had actually been alive since the times of Avraham. He informed Avraham that the latter’s nephew Lot had been taken captive during an intense civil war. This knowledge gave Avraham the chance to rescue his nephew, which he successfully accomplished. Moshe was worried that this merit from hundreds of years earlier would grant Og victory over the Jews. Hashem comforted him and told him not to worry, as the Jews would emerge victorious.
How could Moshe have been worried that Og telling Avraham about Lot would give him any merit? We know that he had bad intentions. He told Avraham solely so that Avraham would die in battle, and Og could marry Avraham’s wife Sarah. Even though it was a very good thing that he did, having negative intentions should have prevented it from being considered a mitzvah. As well, Hashem already promised Moshe that He would bring them into the land of Israel. What was there to fear? How could Og have ever stopped them?
It would appear that Moshe surely knew that Og couldn’t have stopped them. However, every mitzvah deserves its reward. Since, at the end of the day, Hashem’s name was sanctified with Avraham’s miraculous victory in the civil war. This was because Og informed Avraham about Lot’s capture. Since he was the cause, there was some merit that was generated. Even though his negative intentions deserved punishment, the good that came from it comes with its reward.
This tension needed a proper ruling. Should Og be meritorious enough to stop the Jews? Or should his evil intentions override the reward. Of course, Hashem’s judgement would determine that the Jews would be victorious. They were promised to enter the land of Israel, and there’s no way Og could stop them. However, Moshe wanted their victory to be a result of Hashem’s love, not as a result of His judgement. Hashem reassured Moshe that their victory would be solely because of His love for the Jews, and not because of a judgement call weighing out Og’s reward against the promise to the Jews.
At the end of the day, we can learn from this the power of a single good deed. Although Og had horrible intentions, he wanted Avraham to die, it created some reward. This reward lay dormant for hundreds of years. It was almost enough to override Hashem’s promise to the Jews. You would think it wouldn’t count for anything. However, since at the end of the day something good came of it, that couldn’t be completely ignored. When we perform good deeds, they may not always have pure intentions. Of course, having no ulterior motives is the ideal. At the same time, whatever motivates us to help others, there’s some reward in store for us. That should inspire us to do our best to get rid of those ulterior motives.
 Based on Darash Moshe to Numbers 21:34
 Literally: dwells. This is also how Targum Onkelos ad. loc. renders the verse. However, Targum “Yonasan” and Yerushalmi have דהות יתב, passed tense
 Numbers loc. cit.
 See Rashi to Numbers 20:1
 To Numbers 21:34
 Niddah 61a; Midrash Tanchuma Chukas § 25
 There are various opinions as to the history of Og. Some say he was Sichon’s brother (ibid). Some say he was from before the flood, and he survived by holding on to the Ark (Niddah 61b and Zevachim 113b; see Da’as Zekeinim ad. loc. who explain how both of these two points could be true). Some say that he was Eliezer, the slave of Avraham (Soferim 23:9; Pirkei D’Rabbi Eliezer Chapter 16; Yalkut Shimoni § 765)
 Genesis 14:13 with Rashi, quoting Midrash Tanchuma loc. cit., Bereishis Rabbah 42:8, and Midrash Aggadah to Numbers 21:26
 Rashi loc. cit., quoting Midrash Aggadah loc. cit.
 See Bava Basra 10b, which bases its teaching on Proverbs 14:34
 לפי שהקדוש ברוך הוא אינו מקפח שכר כל בריה (Pesachim 118a)
 See Megillas Sesarim’s introduction to Esther who says a similar idea about Haman
 We see similarly by the splitting of the sea, where the Jews were promised they would be freed from Egypt, yet Moshe prayed anyways (see Rashi to Exodus 14:15).