The Church teaches that only God forgives sin. When we turn to God with a contrite heart, and ask for forgiveness of our sins, He forgives us.
However, when we sin, we cause harm to the body of Christ here on earth, which is the Church and therefore, must be reconciled to the Church, which is done in confession. Through this sacrament, we also receive grace which helps us to avoid committing sin.
In the first centuries of the Church, going to private confession was forbidden by the Church. In those days, a person who needed confession had to stand up before the congregation, and confess their sins. However, there were only three serious sins that required this, apostasy(rejection of faith), theft and adultery.
After confession, the person would be given a penance and allowed back into the community.
During the time when the Church was under persecution in Ireland, the clergy were confined in a form of house arrest, where they had to stay behind monastery walls and were not allowed contact on the outside of those walls. So, the monks built little rooms along the outside edge of the monastery wall, with little windows looking into the room. Here, a person could enter the private room and speak with a priest. There they would confess their sins and receive absolution.
The people loved this form of confession, especially over public confession, and the positive effect was so great, that it carried on even after persecution ended and the form moved through the rest of Europe, until the Church finally lifted the ban against private confession.
Today, we continue this form of confession, and those of us who frequently go to confession, know the blessing it is.
The key is to find a good confessor. Once you find one, hang on to him for dear life.
Jim