Back in the 1700s the RN (which the US basically followed) had three levels of admiral compared to four levels of general (plus admiral of the fleet and field marshal at the very top). They also had automatic promotion by seniority for admirals, so to get around that, they came up with a temporary rank of commodore, which was basically to let a captain do the job of a rear admiral without waiting for his number to come up on the list.
So commodore lined up with brigadier general in the army. But it was never considered a real flag rank like an admiral. In fact, if they met up, a more senior captain could still boss around a commodore. And standard promotion was from captain to rear admiral. But in the Civil War the USN wanted a navy rank to line up with brigadier general, so, what titles were there to choose from? And they made commodore the real, permanent one-star rank.
So in the late 1800s, the US started to feel its way onto the world stage. And in every port a naval vessel goes, there is a formal protocol system of honors and salutes and visits, with juniors paying respects to seniors according to international standards. This was picky stuff but it could start a diplomatic incident. And there were British rear admirals and vice admirals and even admirals all over the place, while the US had a handful of commodores and rear admirals. So, US commodores were always at the bottom of the heap and getting snubbed. And finally in 1899 the US decided, we've had enough of this, we won the Spanish-American War, we want our props, so all our commodores are now rear admirals, period. Promotion would now be from captain straight to two stars, but only one-star pay for the junior ("lower") half of the total number of rear admirals.
This, understandably, did not go over well with Army and Marine and later Air Force one-stars, so they bitched about it for about 80 years. Finally Congress gave in and said, fine, navy officers will have to be promoted to one star, and again to two stars, just like the generals. So, in 1980 they brought back the classic title of commodore, but, so the navy officers could still be called "admiral" for short, came up with "commodore admiral." That satisfied no one, probably because it sounds so stupid, so tried just commodore for a few years, and then in '86 they threw up their hands and went back to "rear admiral (lower half)," which also sounds stupid and doesn't make literal sense, but that's where they left it.