Since Joseph cannot be both "begotten of Jacob", descended from Solomon (according to Matthew 1), and also "of Heli", descended from another of David's sons, Nathan (according to Luke 3) various explanations have been proposed for the Luke genealogy actually to be that of Mary.
Another possibility is that since both Heli and Jacob have a similar name listed as their father (Matthan in Matthew, Matthat in Luke), a discrepancy that can easily be accounted for by error, that the names Heli and Jacob refer to the same person.