They are officers of the court with a specific role - to protect the rights of the accused. We want to catch criminals, but this is not the Middle Ages, we don't strip the accused of rights and torture them to death. We don't strip them of access to at least one human being who can protect their rights. And we don't have attorney-client privilege just to protect criminals. We have it to protect the innocent. So if YOU are falsely accused, YOU can tell your attorney the truth without fear that the one person who can protect you will be another witness against you.
And even the attorney-client privilege has limits. If you tell your attorney you are about to murder someone, there is no more privilege and he has to call the police.
But if you tell a priest you are about to murder someone, the priest has to let you do it and pretend he knows nothing about it. Which would normally be a crime in itself, but it's okay because he's a priest of the Roman Catholic Church, which says that God would rather let an innocent person die than block a murderer's path into heaven.