There's nothing in the gospels per se that tells us Jesus was a carpenter. Mark 6:3 has 'the many who were listening' in the synagogue remark:
Is not this the craftsman (Gr. ho tekton), the son of Mary and brother of James and Joses and Judas and Simon, and are not his sisters here with us?"
And Matthew 13:55 reads:
Is not this the craftsman's son (Gr. ho tou tektonos vios) ? Is not his mother called Mary? And are not his brothers James and Joseph and Simon and Judas?
referring to Jesus as the son of the craftsman. Here 'the craftsman' is traditionally inferred to be Joseph, but there is possibly some intentional double-entendre going on here, where 'God' is (either solely or jointly) meant. Double entendre was a very common, often sophisticated, rhetorical device in ancient literature. Many ancient texts employed wordplay, and exercises in composing it were a standard part of progymnastic rhetorical education.
As you can see, the word used in Greek is 'tekton,' which normally translates to 'craftsman; a workman; the author, designer, or planner of a work.' A carpenter would have been one type of tekton.
Now because this is a historical sub, and I'm not a theologian, I don't want to go into theological interpretations, but suffice it to say, 'the craftsman' shares some curious parallels with the Middle Platonic concept of a demiourgos, a 'skilled craftsman,' which was current in the Hellenistic Jewish thinking of Philo of Alexandria.
Also curious to note are all of the references to stones and masonry in the gospels - far and away more than any that might possibly be construed as having to do with carpentry. So there is a distinct possibility that the kind of 'tekton' the gospel writers had in mind was not a carpenter at all, but a stone mason.
[Edits] Cleaned up the text a bit.
If Jesus is never explicitly stated as a carpenter, how did this myth come about?