Matthew is the genealogy of St. Joseph, but Christ could not inherit the throne from Joseph by birth. Two reasons why, one the sin of Adam (by federal headship not actual guilt) is received from father to progeny as Genesis 3 makes clear that the cursing of the earth is because of Adam’s sin and not Eve’s. Two, the line of Kings of David through Solomon is cursed (Jeremiah 22: 24-30). So Joseph is the rightful heir to David’s Throne but he cannot inhabit it because of the sins of his fathers, and neither could a biological son.
The second line is the line of Mary. It is not unusual to name a son (even a son-in-law) instead of a daughter, especially when the son is married to the only daughter and thus becomes heir to the inheritance of her father. Mary is also of David but through Nathan instead of Solomon and thus also has a claim to the throne being of the next son and not of the cursed line. So the Lord has right to the throne through both parents.
This raises the issue of then how is Jesus the rightful High Priest since it is handed down by family.
The answer is found in Psalm 110 where the Messianic King is said to be a “priest forever after the order of Melchizedek…” That is Melchizedek was a Priest to the Lord to whom Abraham paid homage and he was accepted as priest when there was no line of Levi and Aaron. He was priest because God declared him to be a priest. In the same way we read in Hebrews 5-7 but especially 7: 14-19 where it says “14 For it is evident that our Lord was descended from Judah, and in connection with that tribe Moses said nothing about priests. 15 This becomes even more evident when another priest arises in the likeness of Melchizedek, 16 who has become a priest, not on the basis of a legal requirement concerning bodily descent, but by the power of an indestructible life. 17 For it is witnessed of him, “You are a priest forever, after the order of Melchizedek.” 18 For on the one hand, a former commandment is set aside because of its weakness and uselessness 19 (for the law made nothing perfect); but on the other hand, a better hope is introduced, through which we draw near to God.” For that reason we need not try and explain how Mary was of the line of Levi when the text clearly tells us that she was of the line of David and thus the House of Judah, and neither do we need to explain how Jesus, being from the house of Judah, was a Priest before God.
God Bless