Jesus Christ was sent to save sinners. Through the power of the Holy Spirit, his death reconciled the world to the Father. After his resurrection, Christ sent the Holy Spirit upon the apostles, empowering them to forgive or retain sins and sending them forth to all peoples to preach repentance and the forgiveness of sins in his name.
The Lord instituted the sacrament of Confession or Penance when he said to Peter and the apostles:
whatever you bind on earth will be bound in heaven, and whatever you loose on earth will be loosed in heaven.
Thus when we fall into sin after baptism, we can be reconciled with God and renewed in grace through the sacrament of Confession or Penance.
Sin involves an offense against God and, in addition, harms our brothers and sisters. Our friendship with God and with each other is thus always disrupted. The sacrament of Confession or Penance thus reconciles us with God and at the same time with the Church.