Confession or the Sacrament of Penance or Reconciliation was instituted by Christ
“Jesus said to them again, ‘Peace be with you. As the Father has sent me, even so I send you.’ And when he had said this, he breathed on them, and said to them, ‘Receive the Holy Spirit. If you forgive the sins of any, they are forgiven; if you retain the sins of any, they are retained’” (John 20:21-23).It is not a priest, simply as an individual man, who has power to forgive sins.
This power belongs to God alone; but He can and does exercise it through the ministration of men.
Three things are needed in order to receive the sacrament properly:While this sacrament as a dispensation of Divine mercy facilitates the pardoning of sin, it by no means renders sin less hateful or its consequences less dreadful to the Christian mind; much less does it imply permission to commit sin in the future. In paying ordinary debts, as e.g., by monthly settlements, theintention of contracting new debts with the same creditor is perfectly legitimate; a similar intention on the part of him who confesses his sins would not only be wrong in itself but would nullify the sacrament and prevent the forgiveness of sins then and there confessed.
An ordained priest with requisite jurisdiction and with the "power of the keys", i.e., the power to forgive sins which Christ granted to His Church. Edited from the Catholic Encyclopedia
In the administration of the Sacrament of Pardon and of Reconciliation, the priest — as the Catechism of the Catholic Church recalls — acts as "the sign and the instrument of God's merciful love for the sinner" (n. 1465). What takes place in this Sacrament, therefore, is especially a mystery of love, a work of the merciful love of the Lord. Pope Benedict XVI