In Biblical times, the firstborn son received double the inheritance of other sons. Reuben, forfeited his entitlement when he slept with father's concubine, Bilhah (Genesis 35:22). One sinful action had long-term repercussions. Reuben's double blessing passes to Joseph. His sons, Ephraim and Manasseh, become tribes in Israel, alongside Jacob's other sons: Reuben, Simeon, Levi, Judah, Dan, Naphtali, Gad, Asher, Issachar, Zebulun and Benjamin (Genesis 48:5-6).
Reuben also lost the position of leadership in the family, and this passes to Judah. When Judah and his brothers go to Egypt for food, it is Judah who takes the lead (Genesis 43-44). Later Jacob's prophesy of continuing leadership for Judah, predicts the coming of Jesus (Genesis 49:10).
We don't receive God's favour or leadership by natural order. It is easy to appreciate why God chose Joseph, who was faithful in challenging circumstances. The choice of Judah is more difficult to understand. We see him behaving badly in Genesis 38, choosing a wife from the Canaanites, not honouring his obligation to his daughter-in-law, and visiting a prostitute. However, in Genesis 38:26, he acknowledges his daughter-in-law's righteousness, and the lack of his own. There was an honesty of heart. God is looking for those who are faithful and honest of heart.
As Samuel learnt, "People look at the outward appearance, but the LORD looks at the heart" (1 Samuel 16:7).