The family line in Jewish culture was considered to pass down through the man, as shown by other biblical genealogies. So Matthew begins his gospel by giving Jesus' genealogy through Joseph (Matt.1:1-17). It established his humanity, and it was important to show that he was descended from David, because God had promised David that there would be a king from his line who would reign forever.
2 Samuel 7:16
And your house and your kingdom shall be made sure forever before me. Your throne shall be established forever.
But a closer inspection of the genealogy reveals some women, and some potential problems. Tamar (v.3, see 1 Chron.2:4) dressed as a prostitute and seduced her father-in-law, Rahab (v.5, see Josh.2:2) was a foreigner and a prostitute, Ruth (v.5, see Ruth 1:22; Deut.7:1-4) was also a foreigner, and Bathsheba (see 2 Sam.11) committed adultery with David. Why would he include such things? Perhaps it was to point out that God's plans cannot be thwarted, and even where there is sin, his purposes will still work out.
Although he wanted to establish Jesus' humanity, it was important that he was not 'just' a man. Matthew points out that Mary was 'with child from the Holy Spirit' (1:18, 20).
Since therefore the children share in flesh and blood, he himself likewise partook of the same things, that through death he might destroy the one who has the power of death, that is, the devil, and deliver all those who through fear of death were subject to lifelong slavery. For surely it is not angels that he helps, but he helps the offspring of Abraham. Therefore he had to be made like his brothers in every respect, so that he might become a merciful and faithful high priest in the service of God, to make propitiation for the sins of the people.
In Matthew 3:13-17 we read of Jesus' baptism. John knew he did not need to be baptised for repentance, but Jesus insisted "for it is fitting for us to fulfil all righteousness." Following his baptism, Jesus went into the wilderness and was tempted (Matt.4:1-11). Both these things show that Jesus was human, and it was important that he experience the same as we do, but remain sinless, as the Hebrews passage above tells us.
So, in order to represent humanity before God, it was essential that Jesus be human, and Matthew takes pains to establish this. He lived as a man but was sinless, so he had no sin to pay for, and thus could take our sin and pay the price.
[Based on a sermon and Bible study from Pastor Pete Orphan]
Other posts in this series:
Jesus as Leader
Jesus as Divine
Jesus the Man
Jesus as Teacher
Jesus and Us
Jesus as Messiah
Jesus as Saviour
Jesus as Lord
What is a Man?
1 month ago