Kyrie Eleison was derived from a phrase in the bible including the Psalm from the Old Testament. The Kyrie Eleison or Lord have mercy was also occur in the New Testament three times in the Gospel of St. Matthew. It is one of the oldest prayers and most use prayers in the church.
In the Traditional Latin Mass or the Tridentine Mass, Kyrie Eleison was prayed three, followed by three Christe Eleison or “Christ, have mercy” and another three Kyrie Eleison. But why there are first three Kyrie Eleison, three Christe Eleison and another three Kyrie Eleison? Simple answer is the Holy Trinity. Three Persons, one God. The first three Kyrie Eleison is for God the Father, the three Christe Eleison is for our Lord, Jesus Christ, God the Son and the last three Kyrie Eleison is for the God the Holy Spirit. Each Person has three-fold prayer that symbolize that the three Persons in the Holy Trinity are equal. But during the Vatican II, in the Mass of Pope Paul VI, the prayer was no longer used in Greek then each three-fold was reduced into two. One of the reasons of reducing it into two-fold it is because the Protestants hated the repeated prayer.
The Kyrie Eleison was also used in the beginning of the Litanies.
Souce:
https://www.newadvent.org/cathen/08714a.htm
https://en.wikipedia.org/wiki/Kyrie