At what time in his life did Jesus know he was Jesus? Was he a perfect baby? How did Mary mother a perfect son?
The writer of Hebrews wrote that Jesus “learned obedience” (Heb. 5:8). “Learned” (manthano) literally means “to learn, to increase one’s knowledge, to be increased in knowledge.” Luke also wrote that as a child Jesus “increased in wisdom” (Lk. 2:52; cf. 2:40). Isaiah also prophesied of the Messiah that there would be a time before “he knows enough to refuse evil and choose good” (Is. 7:14-15).
This tells us that Jesus was like any other infant or small child, lacking the cognitive ability to know right from wrong. He had to be taught these things by his parents.
Concerning when Jesus knew that he “was Jesus,” i.e., Deity, several possibilities are given from Scripture. At age 12 he apparently knew God was his Father (Lk. 2:49). Perhaps he had this knowledge inherently due to being Deity (John 1:1, 14), or perhaps he was taught this knowledge (Lk. 2:40, 52). At age 30 he already understood it was right for him to be baptized by John, acknowledging that John spoke of him being superior (Matt. 3:13-15). So perhaps he knew of his Deity throughout his life.