It's been used several ways.
* In the old Royal Navy, it was a rank between captain and admiral.
* When I was a kid, it was the lowest rank of US Naval flag officer. You were a captain (O-6), then a commodore (O-7), then a RADM (O-8). Now, there are just two sub-ranks of RADM.
* In some Naval traditions, when an officer of Captain rank was on another captain's ship, they were sometimes called "commodore", as an honorific. They could not be called "captain" because a ship has one captain: the one actively in command.
* Sometimes a person of some import concerning ships is called it because it sounds cool. Cornelius Vanderbilt made a sizable fortune in merchant shipping before he sold out and put everything into railroads, so he was known as the Commodore.