16Therefore confess your sins to one another, and pray for one another, so that you may be healed. The prayer of the righteous is powerful and effective. (James 5:16)

5When you realize your guilt in any of these, you shall confess the sin that you have committed. 6And you shall bring to the Lord, as your penalty for the sin that you have committed, a female from the flock, a sheep or a goat, as a sin-offering; and the priest shall make atonement on your behalf for your sin. (Leviticus 5:5-6)

5 The Lord spoke to Moses, saying: 6Speak to the Israelites: When a man or a woman wrongs another, breaking faith with the Lord, that person incurs guilt 7and shall confess the sin that has been committed. The person shall make full restitution for the wrong, adding one-fifth to it, and giving it to the one who was wronged. (Num 5:5-7)

22When he had said this, he breathed on them and said to them, ‘Receive the Holy Spirit. 23If you forgive the sins of any, they are forgiven them; if you retain the sins of any, they are retained.’ (John 20:22-23)

10For one believes with the heart and so is justified, and one confesses with the mouth and so is saved. (Rom 10:10)

This is some of the verse in the bible that stated clearly that we should confess our sin to one another, and of course to the church. The priest is a person who has the authority from God to forgive sin and also the representation of the church.
There is also an explanation taken from book Lord, Have Mercy written by Scott Hahn.

Sin is a transgression/disobedience/wrongdoing against almighty God. When we sin we reject the love of God. There are two big categories of sins: Original sins and Actual sins.
Original sin is hereditary but impersonal. It is contracted, not committed; and we contract original sin without personal consent/ permission. That is why God can remove original sin without personal consent, as He does with newborn babies on their baptism day.

The same thing cannot be said for actual sin. Actual sin can only be committed through informed consent, or we can say by some action or deed. And so it can only be removed through informed consent. That’s why we need confession.