The genealogy in Matthew reflects Jesus as the Som of Man.
It records the details of His physical birth.
Mary was found with child by the Holy Spirit,
before having any relations with Joseph.
Joseph acted righteously and didn't have her
stoned. He was going to put her away privately.
An 'angel of the Lord' visited him in a dream.
He obeyed and remained with her.