Why is St. Joseph depicted as an old man in christian art?

The main sources of our familiar artistic depictions of St. Joseph are, interestingly, not canonical.
The Patron of the Universal Church, Saint Joseph, is rarely mentioned in the Gospels. The gospels of John and Mark do not mention him at all, and Luke only refers to St. Joseph twice –once in Jesus’ “genealogy”, to establish his belonging to David’s bloodline, and once in the narrative concerning Jesus’ birth. One might think, then, the sources from which tradition has gotten its inspiration and information to represent him visually are reduced to, exclusively, Matthew’s Gospel. But that is not the case.
The apocryphal Protoevangelium of James
The apocryphal Protoevangelium of James, written sometime in the 2nd century and attributed to (though not composed by) the Apostle James the Less, was read and even quoted by some early Christian authors. This “gospel” expanded on what is known about Mary and St. Joseph from the canonical Gospels, providing the traditional names of Mary’s parents and the stories of her childhood dedicated to the Temple and her engagement to Joseph. It was not admitted into the canon of Scripture when the New Testament was officially determined, but its influence endured in Christian iconography.
Iconography, as defined by the founding scholars of the Warburg Institute — Aby Warburg, Fritz Saxl and Erwin Panofski, the great art historians of the late 19th and early 20th centuries — is a branch of art history in charge of studying the identification, description and interpretation of the content of images. When we speak about the iconography of religious art, we are referring to the settings, symbols, and other visual language used to convey the essence of a saint’s life and meaning. If we think about the iconography of St. Joseph, for example, we might say he’s traditionally shown as a man much older than Mary (traditionally a widower with grown children), and he often holds a staff topped with either a dove or blossoming lilies. Both of these very familiar depictions come to us not from the canonical Gospels, but from the Protoevangelium.
From the protoevangelium:
Mary was in the temple of the Lord as if she were a dove that dwelt there, and she received food from the hand of an angel. And when she was twelve years old there was held a council of the priests, saying: Behold, Mary has reached the age of twelve years in the temple of the Lord.
What then shall we do with her, lest perchance she defile the sanctuary of the Lord? And they said to the high priest: You stand by the altar of the Lord; go in, and pray concerning her; whatever the Lord shall manifest unto you, that also will we do. The high priest went in, taking the robe with the twelve bells into the holy of holies; he prayed concerning her. And behold an angel of the Lord stood by him, saying unto him: Zacharias, Zacharias, go out and assemble the widowers of the people, and let them bring each his rod; and to whomsoever the Lord shall show a sign, his wife shall she be.
“I have children, and I am an old man, and she is a young girl”
The heralds went out through all the circuit of Judæa, and the trumpet of the Lord sounded, and all ran. Joseph, throwing away his axe, went out to meet them; and when they had assembled, they went away to the high priest, taking with them their rods. He, taking the rods of all of them, entered into the temple, and prayed; and having ended his prayer, he took the rods and came out, and gave them to them: but there was no sign in them, and Joseph took his rod last; and, behold, a dove came out of the rod, and flew upon Joseph’s head. The priest said to Joseph; You have been chosen by lot to take into your keeping the virgin of the Lord. But Joseph refused, saying: I have children, and I am an old man, and she is a young girl.
I am afraid lest I become a laughing-stock to the sons of Israel. And the priest said to Joseph: Fear the Lord your God, and remember what the Lord did to Dathan, and Abiram, and Korah;how the earth opened, and they were swallowed up on account of their contradiction. Now fear, O Joseph, lest the same things happen in your house. Joseph was afraid, and took her into his keeping. And Joseph said to Mary: Behold, I have received you from the temple of the Lord; and now I leave you in my house, and go away to build my buildings, and I shall come to you. The Lord will protect you.
Giotto’s image of the Marriage of Mary and St. Joseph

Interestingly, even after the canon of the New Testament was finally defined this legend remained widely known, at least in Western European Christianity. It was compiled in Jacobus De Voragine’s 13th-century Golden Legend, a collection of hagiographies (stories of saints’ lives and miracles) originally entitled Legenda Sanctorum, which became quite a medieval bestseller. The Golden Legend’s depiction of St Joseph, along with colorful stories about many other popular saints, such as St. George and the Dragon and St. Christopher, influenced visual artists even to our own day. The Golden Legend added the detail of Saint Joseph’s rod blossoming with lilies, the traditional flower of purity, as a sign that Joseph’s relationship with Mary was chaste. In some images of St. Anthony of Padua, St. Joseph is seen handling him his own staff of lilies, symbolizing St. Anthony’s purity and spiritual guardianship of the Infant Jesus.
Catholic artistic representation of St. Joseph

By rejecting much of the iconography of Catholicism, the Protestant Reformation prompted a change in Catholic artistic representation, too. By the 16th century, the image of St Joseph as an elderly, balding man half asleep on his feet at the Nativity was beginning to be replaced by images of a younger, more vigorous carpenter, closer to the canonical depiction of the saint. This change was brought about particularly due to the influence of Johannes Molanus, the influential Flemish theologian who was rector of the University of Louvain in the 16th century. His treatise De historia SS. imaginum et picturarum pro vero earum usu contra abusus (The Stories of the Saints in Images and Pictures for the Truth of Them and Against Abuses) was one of the most important texts to which artists of the Counter-Reformation would refer.
Read More:
Struggling with purity? Try the cord of St. Joseph!
Why St. Joseph is patron and protector of the unborn