Zechariah had apparently prayed specifically that God would allow he and his wife to have children.
So, Zechariah's prayer, like Abraham's, Isaac's, Rachel's, Hannah's and others, was heard. The angel was merely announcing to Zechariah that his prayer would be answered. So, he actually doubted God's proclaimed provision and answer to his prayer.
Mary, however, had certainly not ever prayed that she would have a miraculous child out of wedlock, and a virgin had never given birth before, so her questioning is a quite a bit more understandable than that of Zechariah.