From our perspective 2000 years after the events of the gospel accounts, we may find Mary's lack of understanding about Jesus to be puzzling. After all, she had been given an angelic announcement of His birth—not to mention the miraculous conception of a child to a virgin. Yet, when the shepherds told her what the angels said (Luke 2:8-20), she pondered this announcement as if not completely understanding.
Years later, Jesus stayed behind at the Temple in Jerusalem to listen to and speak with the teachers (Luke 2:41-52). His parents, however, did not understand His desire to be in His "Father's house." In fact, they chastised Him for causing them to worry.
Given the events surrounding His birth, shouldn't Mary have known of His divine nature as the Son of God? The answer lies within the question. Jesus's mission on earth required that all events be fulfilled exactly as we have them. This includes His submission to a fully human life.
Had Mary known the complete mission from the beginning—that He was fully God and fully man—the human side could never have been fulfilled. The thought of His divinity would have been too all-consuming. What bond could His family or disciples have shared with Him if they had known they spoke with God? Christ humbled Himself to live as we do (Hebrews 4:15), something that would have been impossible if all had been known from the beginning.
Beyond this, the gradual revelation of Jesus's mission also provided important instruction to those closest to Him. Just as the disciples came to understand whom they followed, Mary realized day by day, revelation by revelation, that she had indeed given birth to the Son of the living God. The lessons had all the greater impact being understood gradually than they would have if given all at once.
Adapted from The Life and Times of Jesus the Messiah by Alfred Edersheim (Book II, Chapter VII).