The Yalkut Shimoni (812) says, “Why did Moshe Rabbeinu pray to Hashem (“I implored Hashem,” etc.)? So that he would be allowed to enter Eretz Yisroel.”
The Zera Shimshon asks the obvious question. We do not need the Yalkut to teach us that Moshe Rabbeinu’s tefillos were so that he could enter Eretz Yisroel. The passuk (ibid. 25) clearly says that this was part of his tefillah.
The Zera Shimshon explains this Yalkut based on the following Gemara:
The Gemara (Sota 14a) says in the name of R’ Simlai: Why did Moshe Rabbeinu want to enter Eretz Yisroel? Obviously, it was not to eat the fruits of the land. Rather, it was because he wanted to fulfill the mitzvos that could only be done in the land of Eretz Yisroel. To this request, Hashem said, “If it is about the reward, I will consider it as if you indeed fulfilled all the mitzvos dependent on the land of Eretz Yisroel, and you will receive the reward.”
The Maharsha asks on this Gemara that even simple people strive to serve Hashem not for the reward. In fact, the Mishnah (Avos 1:3) clearly teaches that one should serve Hashem not for the reward but, rather, for the sake of serving Hashem itself. Surely, Moshe Rabbeinu was not simply concerned over some extra reward?
The Zera Shimshon quotes the Megaleh Amukos (4), who answers the Maharsha’s question as follows:
The Gemara (Erchin 32b) teaches that Ezra HaSofer davened that the yetzer hara of avodah zarah should be abolished. The Gemara asks: It is understandable why Moshe Rabbeinu was not the one to pray that the yetzer hara of avodah zarah be abolished, since he did not have the merit of living in Eretz Yisroel on his side. However, why didn’t Yehoshua, who did possess the merit of living in Eretz Yisroel, pray that the desire to serve avodah zarah be nullified? The Gemara says that, indeed, this was held against Yehoshua, and for this reason, there is one time where Yehoshua’s name is spelled without the letter “hei” (ישוע as opposed to יהושע).
This is why Moshe Rabbeinu wanted to enter Eretz Yisroel, since he needed the merit of Eretz Yisroel to do what Ezra HaSofer did many years later – nullify the yetzer hara of idol worship.
The Megaleh Amukos shows how this is seen in Moshe Rabbeinu’s words. Moshe Rabbeinu said אעברה נא, “Let me cross,” etc. The Rambam, in his introduction, enumerates fifty-one transgressions associated with idol worship. The word נא has the numerical value of fifty-one. The word אעברה has the same numerical value as עזרא (two hundred and seventy-eight). This hints to the real intent in Moshe Rabbeinu’s tefillah and what lay behind his desire to enter Eretz Yisroel. He wanted to accomplish what Ezra did – the nullification of the yetzer hara of avodah zarah through the merit of living in Eretz Yisroel.
With this, the Zera Shimshon explains the puzzling Yalkut he began with, which says, “Why did Moshe Rabbeinu pray to Hashem? So that he would be allowed to enter Eretz Yisroel.”