Here are some different ideas as collected in the Catena Aurea:
Bede: In this is fulfilled the word, which the Lord had spoken, that all His disciples should be offended in Him that same night. There follows: “And there followed Him a certain young man, having a linen cloth cast about his naked body,” that is, he had no other clothing but this linen cloth. It goes on: “And they laid hold on him, and he left the linen cloth, and fled from them naked.” That is, he fled from them, whose presence and whose deeds he abhorred, not from the Lord, for Whom his love remained fixed in his mind, when absent from Him in body.
Pseudo-Jerome: Just as Joseph left his mantle behind him, and fled naked from the wanton woman; so also let him, who would escape the hands of the evil ones, quit in mind all that is of the world, and fly after Jesus.
Theophylact: It appears probable that this young man was of that house, where they had eaten the Passover. But some say that this young man was James, the brother of our Lord, who was called Just; who after the ascension of Christ received from the Apostles the throne of the bishopric of Jerusalem.
Greg., Mor. 14, 49: Or, he says this of John, who, although he afterwards returned to the cross to hear the words of the Redeemer, at first was frightened and fled.
Bede: For that he was a young man at that time, is evident from his long sojourn in the flesh. Perhaps he escaped from the hands of those who held him for the time, and afterwards got back his garment and returned, mingling under cover of the darkness with those who were leading Jesus, as though he was one of them, until he arrived at the door of the High Priest, to whom he was known, as he himself testifies in the Gospel. But as Peter, who washed away the sin of his denial with the tears of penitence, shews the recovery of those who fall away in time of martyrdom, so the other disciples who prevented their actual seizure, teach the prudence of flight to those who feel themselves unequal to undergo tortures.
https://dhspriory.org/thomas/CAMark.htm#14