First - genealogies are part of the Bible! A part we might be inclined to ignore but which God put there - and Matthew even put in for the first page of his gospel, which isn't just a Jewish gospel but one for all nations, something evident from the reference to Abraham in 1:1 and the great commission of the book's final chapter. I once wrote a series in Matthew for a Christian Union, we covered chapters 3-8 but I really wanted to start in chapter 1 but figured it was a bit ask to have the first Bible study a fresher might be in one of Matthew's genealogy - hard but tasty!
In Matthew we have to say that we're given some good hints of why he includes it. He wants to show us (1:1) Jesus' relationship to "David the king" (v6) and Abraham - which is an emphasis on Kingly Authority and Global Blessing. They, and the exile, provide the structure of the genealogy, which concludes with "Joseph, the husband of Mary to whom was born Jesus, who is called Christ". Combined with the story of Jesus' conception this only shows us Jesus' adopted genealogy - and it follows the line of the house of Judah royally, listing the kings and emphasises Jesus as the heir to the throne of Israel.
Luke's genealogy, in Luke 3 works differently. It's in reverse back to Adam the son of God and set in the context of Jesus' temptation serves to highlight Jesus as the true Adam son of God and true Israel son of God. The issues arises because the genealogies are different - they both run with Joseph and are the same from David backwards but different in between. Luke's doesn't follow the kings but rather a line from David's son Nathan down to Joseph. I take it this is the real line of Joseph. Luke isn't looking to emphasise the royalness but rather his divine descendancy... something that anyone has since it's traced from God to Adam and onwards - but put with the temptation/testing of Jesus in the wilderness, like Israel in the wilderness, it shows him as a special Israel-like son of God. See more on that in David Gibson's Three Sons and the Devil.
That at least is my thinking... your comments?