1. From his parents, who could have told of Gabriel's message (and Elizabeth's and Simeon's and Anna's), although reliance on such otherwise-untested human sources would be far from definitive.
2. From the Scriptures which predicted his advent, even to the time, place, and circumstances--today, we still recognize this as definitive and conclusive.
3. From God directly. Although we have no New Testament Scriptural support for such communication in His youth, who can doubt it took place, especially once He saw Himself predicted in scripture?
At age 12, in the Temple, Jesus rhetorically asked His human parents, “Did you now know that I must be in my Father’s house?” or “... doing my Father’s business?” (same Greek root, “oikos.”)
Up to that point, the Bible says nothing regarding His self-understanding, so anything we might believe is largely speculative.