God chooses whom He wills. It may not seem "logical" but there you go. God knows better than us.
Some would have considered, for example, that David was unsuitable to carry the line of Christ since he was guilty of adultery and murder. Yet God chose him. David praised God for bestowing grace on him despite his sin; Mary did the same.
How do you know?
-A8
Well, since the Apostles knew her personally, and the youngest one took her in as his Mother when Jesus died, I will defer to THEIR teachings on the matter. They may not have written an Epistle or a letter to one of the outlying communities to that effect, but it was an accepted teaching in the first century of Christianity, and is one of those traditions on which our Faith was founded.