You might consider posting this question on the Scripture forum. However, I will endeavor to provide a basic reply to the issue. The origins of Joseph pose problems as a result of the genealogies listed in Scripture. According to Matthew (1:16), Joseph was the son of Jacob, while Luke (3:23) names him as the son of Heli; both were of the family of David. The two genealogies provide differences that extend all the way to David, and no satisfactory solution has been provided to account for the discrepancy. It has been proposed, variously, that Matthew’s genealogy was the natural one with Luke’s accounting the list according to the levirate law; and that Matthew’s genealogy was for the line through Joseph and Luke’s for the line through Mary. According to Luke (1:26), Mary was from Nazareth and was descended from priestly lineage (Lk. 1:5).
here to send this Question and Answer to a friend