ANSWER:
There are two common explanations. One common explanation is that Matthew gives the lineage of Joseph – and Luke the lineage of Mary. Matthew 1 lists what apparently is the direct line of descent from Abraham to Joseph, Mary’s husband. However, Luke 3 mentions “Now Jesus Himself began His ministry at about thirty years of age, being (as was supposed) the son of Joseph, the son [or, as it could be translated, “son-in-law”] of Heli” (Luke 3:23). In other words, Heli would be Mary’s father, and the genealogy would thus be hers.
The other common explanation is that since Matthew was written to present Jesus to the Jews as their expected Davidic King, the genealogy in Matthew 1 may have been intended to give the line of legal succession to the throne of David. Such lines did not always correspond to the direct line of succession from father to son. As anciently used in legal lines, “son” sometimes meant only “legal successor.” Luke 3, on the other hand, may trace the actual, father-to-son succession from David back to Adam through another branch of the family