There are several types of cardinals, and all of them have the same origin. The sense of cardinal as a type of bird originated in the 1600s when they were discovered, and was named so because the birds' plumages resembled the robes of a religious cardinal. The word cardinal as pertaining to the ecclesiastical rank derives from the Latin word cardinalis, meaning "principal and essential". It is obvious why this would come to be; religion and religious authorities were paramount at the time. Coincidentally, it is from this same word (cardinalis) that the word cardinal pertaining to direction originated from (think cardinal points on a compass rose), since those directions were about equally significant to daily life at the time. Now, since cardinalis had a meaning of "pivotal", this next change kind of makes half-sense: the term is a portmanteau of the Latin word for "hinge" (cardo, since a hinge is pivotal too) and the irrelevant suffix -alis. This is interesting as it is, but countless possibilities open up with the fact that where cardo comes from is unknown. One interesting theory would make cardo a cognate with the English word hinge: it is possibly from the Proto-Indo-European word nerd ("swing"). Other conjectures follow this to Greek, but we'll never know for sure by which way fate swung cardinal our way.
Adam Aleksic has been described as the internet's sixth most famous etymologist. He loves writing about himself in the third person, he's a freshman at Harvard University, and he has disturbing interests in linguistics, vexillology, geography, board games, limericks, and law.
The Etymology Nerd