In the US Army/Marines/Air Force, a captain is an O3, but in the Navy a captain is an O6. Were these ranks more comparable in responsibilities at some point in the past?
General background on the rank of Captain mores has to do with the title and responsibilities that the rank itself represents. Captain is a general use term for designating the group or unit leader. "Captain of Gondor" is a term that Tolkein used to describe Faramir as the leader of a group of rangers. While that is strictly fiction, Tolkein based almost everything he wrote about on history. So, next up is the history of the word.
Captain comes from Caput which is a designation of a leader of various different sizes/groups. Quite literally it just means "head". So you could be the Captain of your household that you share with 2 cats all the was to the President of the United States given Walt Whitman referred to Abraham Lincoln this way in "O Captain, My Captain!". Interestingly enough, Caput serves as the etymological head, or caput as it may be, of many words like capital and chapter. So before the rank was the title.
Ships used to be commanded by a master and a boatswain dating all the way back to the 1000s. Starting in the 1600s, as ships grew in size and total responsibilities for officers and crew, the word "captain" starting coming into use to describe the overall commander of the ship, but this wasn't actually formalized. It was more of a colloquial term for a ships commander and nothing had been stringently laid forward and adhered to. In fact, not just the ranks but also the uniforms of the Royal Navy. There were no set standards on dress, ranks, anything.
Until the 1740s. When it was abundantly clear to the Admiralty that more organization was needed for the Royal Navy, there was a push to formalize a rank structure as well as uniforms. There is still a huge amount of history there, but in the interest of keeping it simple, we'll just stick with "Captain" as a rank was more of a designation of a title in being the "ships master and commander".
The Army kept a relatively consistent application in terms of number of troops overseen and general responsibilities. Same as with the Royal Navy, the Army saw the matriculation of the Army's rank system in the mid-1700s. The use then referenced the leader of a company of men, ranging from 60-100 men, given the size of the Regiment and it's losses/etc.
A Regiment was usually furnished by a wealthy aristocrat who would be given the title of "Colonel-Captain" designating him as the leader of the Regiment as well as the Captain of a Company. Under him would be a "Lieutenant-Colonel" referencing Lieutenancy which is assistant so he would be the executive officer as well as being the captain of a company. "Major-Captain" who would serve as the Regiment as well as the Captain of a company. The rest of the companies, usually 7 more, were led by a Captain. Over time, the "-Captain" or "and Captain" was dropped and the Officer was referred to simply by his senior rank or "Colonel", "Lieutenant Colonel" and "Major".
TL;DR
So basically, the 2 ranks started off as general titles as a leader of a group or unit of men. Time just saw the responsibilities of a ships captain taking off, but the rank designation still stayed in place.
/u/Sphinx111 has a good explanation here: https://www.reddit.com/r/AskHistorians/comments/1iecii/what_is_the_history_of_the_rank_captain_why_is_an/cb3r09e/