We don't know for sure.
The Greek word in the Bible is τέκτων (tektōn) - it simply means one who works with his hands. We get the English word "technology" from the same Greek word. It COULD include a carpenter but then it could include a vast, vast number of other things, too. Often a "tekton" was a day laborer but it could mean any kind of craftsman, a person who made his living with the skill of his hands. A "carpenter" simply would be one possibility or variety of a "tekton."
The TRADITION that Joseph was a "carpenter" (a wood worker, not a house builder) came very early. St. Jerome in the Latin Vulgate Bible simply inserted that tradition into his translation - and later western translations to this day continue that, following Jerome's lead, inserting the tradition.
The Bible nowhere states that JESUS was a tekton... but it was common for sons to have the same vocation as their father.
.