The custom is biblically inspired and was instituted by Pope Gregory X in the 13th century.
There are many bodily gestures that Catholics perform at Mass, and one of them that was widely practiced for centuries was the custom of bowing one’s head at the mention of the name of Jesus. Even though it has not been greatly emphasized during the past few decades, it is still honored by many of the lay faithful as well as some priests.
The origin of this custom is primarily inspired by the following words of St. Paul in his letter to the Philippians.
Therefore God has highly exalted him and bestowed on him the name which is above every name, that at the name of Jesus every knee should bow, in heaven and on earth and under the earth, and every tongue confess that Jesus Christ is Lord, to the glory of God the Father. (Philippians 2:9-11)
Practically speaking, kneeling every time the name of Jesus is mentioned is rather difficult, and so Pope Gregory X found a solution. He wrote about it to the Dominican Order in 1274, expressing his desire that some physical gesture be done to honor Jesus’ name.
The following portion of his letter was printed in the book With God: A Book of Prayers and Reflections by Francis Xavier Lasance.
Recently, during the Council held at Lyons, we deemed it a useful commendation to exhort the faithful to enter the house of God with humility and devotion, and to conduct themselves while there in a becoming manner, so as to merit the divine favor and at the same time give edification. We have also judged it proper to persuade the faithful to demonstrate more reverence for that Name above all names, the only Name in which we claim salvation — the Name of Jesus Christ, who has redeemed us from the bondage of sin. Consequently, in obedience to that apostolic precept, ‘In the Name of Jesus let every knee, be bent,’ we wish that at the pronouncing of that Name, chiefly at the Holy Sacrifice, every one would bow his head in token that interiorly he bends the knee of his heart.
Pope Gregory wanted everyone to not only honor Jesus’ name, but to interiorly submit themselves to God with a simple act of love. The Dominicans took the pope’s request seriously and became the foremost promoters of the Holy Name of Jesus in the Catholic Church, preaching about the Holy Name, forming Holy Name Societies, as well as placing altars in their churches dedicated to Jesus’ Holy Name.
The custom is a simple one and is meant to reflect an interior desire to honor Jesus, the only name by which we are saved.