Perhaps the meanings are not that different if you think about it like this:
In latin “confidere” means “to trust”.
When you are confident, you have trust in yourself.
“To confide in someone” is to trust them enough to tell them of a secret or private matter.
If something is confidential it is intended to be kept secret. In other words, it is only for people who can be trusted.