וידבר משה אל ה' לאמר
יפקד ה' אלהי הרוחת לכל בשר איש על העדה
אשר יצא לפניהם ואשר יבא לפניהם ואשר יוציאם ואשר יביאם ולא תהיה עדת ה' כצאן אשר אין להם רעה
ויאמר ה' אל משה קח לך את יהושע בן נון איש אשר רוח בו וסמכת את ידך עליו
Rashi
"יפקד ה'" - כיון ששמע משה שא"ל המקום תן נחלת צלפחד לבנותיו (במ"ר) אמר הגיע שעה שאתבע צרכי שיירשו בני את גדולתי א"ל הקב"ה לא כך עלתה במחשבה לפני כדאי הוא יהושוע ליטול שכר שמושו שלא מש מתוך האהל וזהו שאמר שלמה (משלי כז) נוצר תאנה יאכל פריה
1. When Moshe was told that he would lead the Jews, he argued and pleaded that Hashem not make him take the responsibility, that Hashem give the position to someone else, as long as he did not have to do it. Why would he want his sons to be given that responsibility?
2. How could Moshe have thought that his sons were worthy to succeed him? They experienced nothing of the shibud Mitzrayim or Yetzias Mitrayim, and, according to many rishonim, they and their mother were the only living Jews that were not present at Mattan Torah. How were they qualified to lead Klal Yisrael? Nothing they did was recorded in the Torah. Everyone knew that Moshe's successor would be Nadav or Avihu, or Pinchas, or Yehoshua, or Kaleiv, or Nemuel, or whoever, but nobody had a hava amina that Moshe's children were in the parsha of taking their father's place.
3. I understand that Moshe had an obligation to his sons. But it is absurd to think that he was more concerned that his sons be kings than that Klal Yisrael have a great leader. He was a shepherd of Klal Yisrael and the father of Klal Yisrael davka because his concern for their well being was paramount, more important than anything else in the world and certainly more than his self interest.
4. שאתבע צרכי? Or גדולתי? He wanted his gedula to go to his sons? Was it his? He was an eved Hashem with no existence as a self interested Human Being. And now he has "needs?" He wants "My gedula" to go to his sons?
The answer:
The first king to rise to power has to earn the position. In a natural society a king gains the throne by Fear, or Civil Benefit, or Protection. Fear is his ability and the will to crush any citizens that oppose him. Civil Benefit means that he has the ability to benefit the citizens of the state, either economically through the use of his wealth, or socially by maintaining the social order for the benefit of the dominant class. Protection means that he has the power to defend them from enemies, internal or external. The distinction is not absolute. Every king needs the power to defend his throne through fear, and a king that can crush opposition will only be secure if he somehow provides some benefit to the ruling class or society as a whole. (h/t Niccolo M.) But Moshe Rabbeinu acquired the throne not because he could impose his will, not because he could provide economic benefit or maintain the social structure, not because he could protect the people from enemies, but because of his personal character.
Moshe Rabbeinu was made king by Divine appointment. Why was he chosen? He was not a terrorist or a Rothschild or an Eisenhower. The reason Moshe Rabbeinu was chosen was that he was a Godly man - it was only through him that the Ribono shel Olam could speak directly to Klal Yisrael. It was through him that the Torah could be given, and through him that the nation could be formed. He embodied what the Ribono shel Olam wanted Klal Yisrael to be. He was the paragon, the role model of human perfection. (Of course, it was essential that he be a protector and leader and benefactor as well, but there is a difference between central and essential.)
The great annav, Moshe Rabbeinu, was opposed to being singled out as the perfect human being, and he did not want that crown. The Ribono shel Olam insisted, and he became king.
Only a first king needs to earn the throne. Once he's earned it, it belongs to him and to his family as part of his yerusha. Just as a man's possessions naturally go to the person that stands in his place, Moshe Rabbeinu's crown would naturally be his children's. The identification of a child with his parents is self evident, both to the father and to the children. A king's children acquire their power because they speak for their father, they are, in a sense, their father. (Of course, the predictability and tranquility of inheritance is far better than a civil war with every succession.)
Besides the din yerusha, the din that the crown belonged to Moshe Rabbeinu and therefore to his family, there was another reason that Moshe desired that his children succeed him. Chazal say that a man that leaves a child that stands in his place is said to still be alive, to not have died. Moshe Rabbeinu felt that if he were fated to die, at least he could leave a son in his place, a successor, through whom he could be said to be alive.
(BB 116a -
מפני מה בדוד נאמרה בו שכיבה וביואב נאמרה בו מיתה? דוד שהניח בן נאמרה בו שכיבה. יואב שלא הניח בן נאמרה בו מיתה. ויואב לא הניח בן? והכתיב (עזרא ח, ט) מבני יואב עובדיה בן יחיאל! אלא דוד שהניח בן כמותו נאמרה בו שכיבה. יואב שלא הניח בן כמותו נאמרה בו מיתה.)
So why the Hashem say no? I believe that Hashem was telling Moshe that Klal Yisrael, entering Eretz Yisrael, needed another king that would rule on the basis of his spiritual perfection, another role model of what Klal Yisrael aspires to - they needed another First King. Moshe's malchus was in a completely different world, and the first king in Eretz Yisrael would have to establish a completely new state. That is why Yehoshua was chosen, and not Moshe Rabbeinu's son.
(It's tempting to say that Yehoshua was more of a son than his natural sons, as we see in BB 116a - כל שאינו מניח בן ליורשו הקדוש ברוך הוא מלא עליו עברה, and then רבי יוחנן ורבי יהושע בן לוי חד אמר כל שאינו מניח בן וחד אמר כל שאינו מניח תלמיד , but that's not what Chazal say here. They say that Yehoshua deserved it more.)
In brief:
There are two dinim in Moshe Rabbeinu's malchus. The second din is an automatic result of the first din. The first din was that he was was a paragon, a role model of what a Jew should be, and therefore a fitting interlocutor for the Ribono shel Olam and Kabbalas HaTorah. The other was the authority invested in him, the position of leadership. The first only is necessary in the first king in a line. Once the malchus was granted, the second din was automatically chal. Moshe Rabbeinu knew that his sons were not qualified for the title of Toras Moshe. But the second din is an essential definition of kings and an automatic chalos for any king. Moshe resisted becoming king because he would be the first, and therefore needed to embody the first din. Once he had the din melech, then only the second din applies, and that certainly can and should go to his son. Moshe thought that once you established the character of a king, the succeeding generations did not need to do anything but be secular authorities, the second din. But Hashem said that Klal Yisrael, in that their lives would be totally different upon settling in Eretz Yisrael, still needed a king of the first din, and for that, only Yehoshua, to whom Moshe was "moser" the Torah, was fit.