Kyrie Eleison was derived from a phrase in the Bible including the Psalm from the Old Testament. The phrase ‘Kyrie Eleison’ or ‘Lord have mercy’ occurs three times in the Gospel of St. Matthew. This prayer is one of the oldest and most frequently used in the church.
In the Traditional Latin Mass, the first Kyrie Eleison was prayed three times, followed by three Christe Eleison or “Christ, have mercy” and another three Kyrie Eleison. Why is it necessary to recite each of these three times? The 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. The three persons in the Holy Trinity are equal and each person has a three-fold prayer. However, in the Mass of Pope Paul VI, the prayer was no longer used in Greek, and each threefold was reduced to two. One of the reasons for reducing it to twofold is because the Protestants hate 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