See the gemara in Yoma 22b. This was orchestrated in order to ensure the longevity of his kingdom. As Rabbi Yoḥanan said in the name of Rabbi Shimon ben Yehotzadak: One appoints a leader over the community only if he has a box full of creeping animals hanging behind him, i.e., he has something inappropriate in his ancestry that preceded him. Why is that? It is so that if he exhibits a haughty attitude toward the community, one can say to him: Turn and look behind you and be reminded of your humble roots. Sefaria's explanation based on Rashi spells out: This is why David’s kingdom lasted while Saul’s did not, as David descended from a family with problematic ancestry, namely Tamar (see Genesis, chapter 38) and Ruth the Moabite (see Ruth 4:18–22).
If this is so, that it's actually important that a leader have some sort of less-prominent background, why wasn't Rabbi Akiva made a nasi instead of Rabban Gamliel?
In Brachot 27b it says:
Shall we establish Rabbi Akiva in his place? The Sages rejected that option because Rabbi Akiva, who descended from a family of converts, would be vulnerable. Perhaps due to Rabban Gamliel’s resentment he would cause him to be divinely punished as he lacks the merit of his ancestors to protect him.
It sounds like in Yoma that having a poor background is a merit because it humbles the person. So wouldn't this have been enough to protect Rabbi Akiva from Rabban Gamliel? Furthermore, surely Rabban Gamliel knew of many previous leaders who didn't have important "Yichus" – In fact, part of Rabban Gamliel's ancestry was the House of David, no less (exactly what was discussed in Yoma 22b) – why then should this disqualify Rabbi Akiva? Why would he attempt to punish him?