Both Matthew and Luke contain genealogies of Jesus, Matthew to Abraham, and Luke to Adam. However, neither Mark nor John contain genealogies. What is the reason for this--both for why Matthew and Luke do contain genealogies, and for why Mark and John do not?
I don't think we can ever know for sure as we can't ask them. However I think the answer is probably to do with who they are writing to and what is the purpose of their writing.
Matthew is probably writing to a Jewish audience. For them the Christ has to have come from Abraham & David and so Matthew spends the time to show that Jesus has the credentials to be the Christ.
Luke has probably been employed to write the book by Theophilus (debated if that is the persons name or title). He has been tasked to report on what has happened and what it means - thus it goes into a lot of detail.
Mark seems to be focused on just reporting the facts as they happened. He doesn't need to present the background information on what it means, just runs through the events.
John is in a completely different format than the other gospels. In terms of who Jesus is he is very much focused on Jesus' divinity - not his human family.
The Gospel of Matthew appears to be written to Jews in order to present Jesus to them as the King of the Jews. As such, it was necessary to trace Jesus' lineage through Joseph, His adopted father, through the lineage of the kings back to David, whom God promised would have an heir who would reign forever. It was also important to trace His lineage back to Abraham, the Patriarch. As the son of Joseph, Jesus had legal right to the throne.
The Gospel of Mark presents Jesus as the Servant who fulfills the Suffering Servant prophecy in Isaiah 52-53. For a servant, a genealogy is unnecessary and even irrelevant. Thus, Mark does not include one.
The Gospel of Luke presents Jesus as the Son of Man. As such, it is thought that he actually traces Jesus' biological lineage through Mary. Her lineage leads to David as well. However, Luke's emphasis is not the Jewishness of Jesus, but His human nature. As such, he traces the lineage all the way back to the first Adam.
The Gospel of John is said to present Jesus as the Son of God. As such, God has no genealogy. His authority does not come from the legal line of David or in His Jewishness, but in His divinity. Jesus' Divine nature has no genealogy. He is, forever has been, and forever will be the Son of God and God the Son.