It is a very old custom for Christians: no one is admitted to baptism unless accompanied by at least one godfather or godmother.
They are first and foremost there to broaden the family circle: they represent the Christian community, the Church. In a way, they are witnesses to the parents' commitment.
Subsequently, they will be concerned, along with the parents, with the Christian education of their godchild.
The godfather and godmother are therefore not just those who offer a medal and sugared almonds on the day of baptism! They commit to praying for their godchild, to helping them grow in faith, and to supporting the parents in the exercise of their responsibilities.
Traditionally, the choice of godfather and godmother is made based on criteria of friendship or kinship. However, they must be baptized, Catholic, and confirmed (or at least have attended catechism and made their first communion).
However, a baptized non-Catholic person can be a "witness" and sign as such on the baptism register. They then have a role similar to that of a marriage witness. However, there must always be at least one Catholic godfather and godmother.