The Bible does not tell us if or when Jesus realized He was God in flesh (John 1:1, 14; Colossians 2:9). We do not know if He always knew He was divine, even in the womb or if He realized it later on. Each position has its explanatory difficulties. After all, Jesus was made under the Law (Galatians 4:4), and He cooperated with the limitations of being a man (Philippians 2:5-8). Does this require that He also did not know who He was at birth? Not at all. Did the divine nature go "dormant" when Jesus was a baby? If so, what would that even mean? But then again, the divine nature requires that He knows all things. However, we see in the Gospels that Jesus, for example, did not know the day nor the hour of His return. It seems, in this case, He is cooperating with the limitations of being a man since He was made under the law, but this does not mean He did not know who He was in His divinity.
Nevertheless, the earliest hint we have of Jesus being aware of who He was is found in Luke 2:41-52 where He and His parents were going to Jerusalem for the Feast of the Passover. It says in verse 42 that He was 12 years old. On their return trip, He remained in Jerusalem while His parents and the large caravan returned home. They probably presumed He was with other extended family members. When they discovered He was not with them, they returned to Jerusalem, and when they found him, " . . . He said to them, 'Why is it that you were looking for Me? Did you not know that I had to be in My Father’s house?'" (Luke 2:49). So, we can say that He knew who He was by the age of 12 since He was calling God His own father.
But again, since the Scriptures do not give us enough information to answer the question, we cannot say when Jesus came to know that He was God in flesh. So, we should not try to answer the question since we could end up in error.