There are several lessons to be drawn from this genealogy. One of my personal favorites is the four women mentioned: Tamar, Rahab, Ruth, and Mary. Each of these women's stories is mentioned in Scripture, and each has a less than stellar reputation.
To wit:
Tamar played the part of a prostitute, and got her father-in-law to impregnante her, although she was justified in doing so.
Rahab was a prostitute, and says as much.
Ruth was at very least very, very forward with Boaz. When she "uncovers his feet," there is at least the possibility of reading the euphemistic idea of feet as saying that Ruth seduced ObedBoaz by sleeping with him.
Mary was pure, but to the outside world, she looked like an unwed mother.
Even beyond the women, Jesus takes the good and the bad. Yes, David was good and Solomon was wise - but Manesseh's evil was equally on display. Being God, it is not just "an accident of nature." God chose each and every one of these - good and bad alike - to be his forefathers and foremothers. He came to seek and save everyone. He came to seek and save the lost.
Here's the idea - these were not all the pure Queens and noble Kings that the world looks upon. Prompted by the Holy Spirit, Matthew included some awfully shady seeming characters. Why? Because the God who became Man came for precisely this kind of person! Jesus was a King - he was descended from David. But he was not aloof. He came to seek and save even people like this!