Actually Joseph wasn't
Joseph was Jacobs son by birth. Eli was Josephs father in law. When you read the rest of the genealogy that becomes apparent.
The reason for the dual linage was to show that thru either linage Jesus was the heir to the throne of David.
Joe and his Dad.
Ref verses.
Matt 1:16 and to Jacob was born Joseph the husband of Mary,
Luke 3:23... being supposedly the son of Joseph the son of Eli.
The bible seems clear that The Matthew verse tells us that Jacob as the father of Joseph. The term born in the verse seems to indicate that this is the case. Jacob was Josephs biological father.
Some have argued that Luke 3:23 may appear to be in contradiction or error saying that Joseph was the son of Eli. Further research clearly indicates that Joseph was the son-in-law of Eli and that the term and meaning of the word in the ancient Greek language and legal understanding of the title son in this case meant son in law.
Some reasons why.
1)The Son-in-law belief is held by several early Christian writers.
a, Origen
b, Irenaeus
c, Tertullian,
d, Athanasius
e, Justin Martyr
2) It is indirectly confirmed by Jewish tradition. The Talmudic writers wrote of Mary as the daughter of Eli.
3) This verse shows us in what way Christ was the Son of David. If Mary was the daughter of Eli, then Jesus was strictly a descendent of David, not only legally, through his reputed father, but actually, by direct personal descent, through his mother.
4) This point affords a simple explanation of the whole matter. Mary, since she had no brothers, was an heiress; therefor her husband, according to Jewish law, was reckoned among her fathers family , as his son. This would make Joseph the actual son of Jacob, and the legal son of Eli.
The book of Matthew sets forth Jesus' right to the theocratic crown, where Luke sets forth his natural pedigree. The latter employees Joseph's name, instead of Mary’s, in accordance with the Israelite law that genealogies must be reckoned by fathers, not mothers.
I hope that helps.