To prove Jesus deity. Matthew shows the lineage of both sides of Jesus family. Mary was of the blood line from David. As well as his earthly guardian Joseph. Both had direct blood lines from the throne but through different sons. Had Hebrews not fallen into captivity, Joseph would most likely been the king at the time. Proving his lineage proves Jesus right to the throne. As the Jews were looking for a messiah king.
Just like all the other Gospels. It a message of a Savior being born ( Jesus Christ ) to go to the cross and die for the sins of all mankind so that whosoever believes in Him shall not perish but have everlasting life. It's a message of Salvation and how to obtain it.
Matthew, surnamed Levi, before his conversion was a publican, or tax-gatherer under the Romans at Capernaum. He is generally allowed to have written his Gospel before any other of the evangelists. The contents of this Gospel, and the evidence of ancient writers, show that it was written primarily for the use of the Jewish nation. The fulfilment of prophecy was regarded by the Jews as strong evidence, therefore this is especially dwelt upon by St. Matthew. Here are particularly selected such parts of our Saviour's history and discourses as were best suited to awaken the Jewish nation to a sense of their sins; to remove their erroneous expectations of an earthly kingdom; to abate their pride and self-conceit; to teach them the spiritual nature and extent of the gospel; and to prepare them for the admission of the Gentiles into the church. * The genealogy of Jesus. (1-17) An angel appears to Joseph. (18-25)
Matthew intends to prove to the Jews that Jesus Christ is the promised Messiah. More than any other gospel, Matthew quotes the Old Testament to show how Jesus fulfilled the words of the Jewish prophets. Matthew describes in detail the lineage of Jesus from David, and uses many forms of speech that Jews would have been comfortable with. Matthew's love and concern for his people is apparent through his meticulous approach to telling the gospel story. The Gospel of Matthew is an excellent introduction to the core teachings of Christianity. The logical outline style makes it easy to locate discussions of various topics. Matthew is especially useful for understanding how the life of Christ was the fulfillment of the Old Testament prophecies. Read more: http://www.gotquestions.org/Gospel-of-Matthew.html#ixzz2NWIfOf6u