grahame, here is my take on the two genealogies as simply as I can explain it.
The general explanation to the contradictory genealogies is that one is the family history of Mary (Luke’s) and the other is that of Joseph (Matthew’s).
Matthew chapter 1 takes us from Abraham to Joseph, the husband of Mary. It is not the blood genealogy but the royal lineage establishing Jesus’ claim to the throne of Israel. It is important, because as an adopted son of Joseph Jesus has the right to the royal lineage going back to David and Solomon. Matthew's emphasis is on the royalty of Jesus.
The genealogy in Luke goes back, not only to Abraham but all the way to Adam. This is the blood genealogy and ends not in Joseph but in Mary. While Matthew emphasizes the royalty of Jesus, Luke emphasizes his humanity and takes him by blood all the way back to Adam, who is a blood relative to all of us. Luke's emphasis is on the humanity of Jesus.
But Luke does not say that Heli was the father of Mary, it says he was the father of Joseph. How can that be? There are two ways to explain this depending on the complexity you want to get into. You can just say that Joseph was Heli’s son-in-law and let it go at that. Or you can explain the Old Testament marriage laws and how they relate to inheritance, especially in the case of families who left no sons. If you go back to Num 27:8 God made provisions for a man’s goods to go to his daughters if he had no sons. If you look at Num 36:6-8 you see a further provision that for this inheritance to pass to the daughter she had to marry a man from the same tribe and family as their father. That way the inheritance would not pass out of the family. A good example of this in the OT is found in Ruth. One reason she had to marry a near kinsman was so that he could receive the inheritance of her father-in-law. We know of no sons born to Heli, only that Mary had a sister (John 19:25). If, and I know that is a big if that we can’t prove, but if Heli had no sons or those sons died without children, and if Mary married a man of the same family as her father (the house of David), then her husband Joseph would be full legal heir and son to Heli.
From David back to Adam the genealogies match, but from David to Jesus they diverge. Luke’s genealogy goes back through David’s son Nathan while Matthew’s goes back to Solomon. It was very important that Jesus be of the tribe of Judah and family of David. Many Old Testament prophecies say that the messiah would be of the tribe of Judah and family of David. This has to be true if Jesus is the Messiah. But here is the thing; the genealogies are not the only evidence that Jesus was of the family of David. Throughout the NT Jesus is referred to as a son of David and his enemies never used this as a point to challenge him with. Had Jesus not been known to be of the family of David and had not that been easily proven the scribes and Pharisees would have been all over it.
There is also the problem of the curse on Jeconiah. In Jeremiah 22:30 Jeremiah pronounces a judgment on Jeconiah that his children would not rule Israel. There are a number of problems with the judgment; some commentators think it only applied during Jeconiah’s lifetime. Jeconiah’s great-grandson Zerubbabel did rule Israel after the captivity. Some commentators say that Haggai’s blessing of Zerubbabel removed the judgment. But whatever you believe, if the lineage in Matthew, of which Jeconiah is a part, is the lineage to Joseph then the judgment would still not pass on to Jesus. Actually that is a pretty good picture of how Jesus was born without being under the penalty of sin.
Another thing to note – both lineages support the virgin birth.