Before the priest absolves you of your sins, he will ask you to say make and Act of Contrition. Here you say, “O My God, I am heartly sorry.” You are asking God for forgiveness.
According to the Catechism of the Catholic Church
1441 Only God forgives sins.
1446 Christ instituted the sacrament of Penance for all sinful members of his Church: above all for those who, since Baptism, have fallen into grave sin, and have thus lost their baptismal grace and wounded ecclesial communion. It is to them that the sacrament of Penance offers a new possibility to convert and to recover the grace of justification. the Fathers of the Church present this sacrament as "the second plank [of salvation] after the shipwreck which is the loss of grace."47
1449 The formula of absolution used in the Latin Church expresses the essential elements of this sacrament: the Father of mercies is the source of all forgiveness. He effects the reconciliation of sinners through the Passover of his Son and the gift of his Spirit, through the prayer and ministry of the Church:
God, the Father of mercies,
through the death and the resurrection of his Son
has reconciled the world to himself
and sent the Holy Spirit among us
for the forgiveness of sins;
through the ministry of the Church
may God give you pardon and peace,
and I absolve you from your sins in the name of the Father, and of the Son and of the Holy Spirit.48
In confession God forgives our sins, but through the priest, we are reconciled with the Church and the punishment due to sin, is absolved.