The Infancy Gospel of Thomas presented his age from 5-12. But people didn’t like it cause Jesus was cursing folks and killing kids and disrupting teachers and resurrecting whimsically. So, they cut it from the final draft.
In the later medieval times, they were inserting Jesus in King Arthur fanfic. The Spiritualist movement in the 19th-21st century decided to stick him in India, for, you know, reasons.
But my favorite is actually the cultural context for the original story:
Twelve means Jesus was a year before the bar mitzvah but was already acting like an adult and thirty is the -minimum- age for the priesthood (forty+ and after having raised a family is -preferred, but thirty is the minimum).
So, if you were from the tribes of Israel, telling it at the time, basically what you’d get is: omen-filled birth (this guys gonna be great!), smart as a whip before officially becoming an adult, worked as a carpenter and made a bunch of friends, then became a priest (in essence, though he was unattached to the Temple) at the soonest opportunity.