That was likely an ecclesiastical gift to the church ..allowing the church to excommunicate those from their presence at the Lords supper.. for we never see any of those present when that gift was given hearing and 'forgiving " the sins of men , but we do see people removed from the body of the NT church ..
Confession (Reconciliation) is a Sacrament instituted by Christ for the forgiveness of sins. The priest or bishop is bound by secrecy not to reveal the contents of the confessional.
During his lifetime Christ sent out his followers to do his work. Just before he left this world, he gave the apostles special authority, commissioning them to make Gods forgiveness present to all people, and the whole Christian world accepted this, until just a few centuries ago. If there is an “invention” here, it is not the sacrament of penance, but the notion that the sacramental forgiveness of sins is not to be found in the Bible or in early Christian history. (From Catholic answers)
Excommunication ferendae sententiae can be public only, as it must be the object of a declaratory sentence pronounced by a judge; but excommunication latae sententiae may be either public or occult.