A couple of reasons:
The etymology of captain - from Late Latin, Old French and Middle English as "chief, prominent" - is imminently suited to the rank commanding the basic maneuver units on both sea and land - respectively a ship or a company of ~150 men. Note that while today the maneuver unit is usually much smaller than a company, that is only true since the First World War. Prior to that time units maneuvred in the large, deployed as battalions but maneuvrering as companies.
As noted in a comment, the German armed forces has leveraged both Germanic and Romance language roots to derive the distinct ranks of:
An OF-2, NATO equivalent to an British or U.S. Captain (army).
An OF-3, NATO equivalent to an British or U.S. naval Lieutenant Commander (navy) or Major (army).
An OF-4, NATO equivalent to an British or U.S. Commander (navy) or Lieutenant Colonel (army).
Kapitän zur See
An OF-5, NATO equivalent to an British or U.S. Captain (navy) or Colonel (army).
Note that etymology for hauptman, the German rank equivalent to captain, is "head man" - virtually identical to the etymology above for English captain. The main Romance languages of French, Spanish and Italian all also use a derivation from Late Latin "capitaneus". This speaks to the language-independent nature of the unit size commanded by an army captain being in some sense fundamental.
Likewise, when the New Model Army was formed by parliament in 1645 it's general officers were, in descending authority:
Captain General Sir Thomas Fairfax;
Lieutenant General (of Horse) Oliver Cromwell;
Major-General (of Foot) Philip Skippon
Lieutenant General (of Ordnance) Thomas Hammond
Although out of favour in Great Britain since 1799, this rank and it's literal equivalents in other languages remains common as the rank of a senior general officer. Again, the notion is that the most senior commander at a conceptual level, here strategic, is the captain - the chief, or most prominent commander at that level. Likewise the captain's second-in-command is a lieutenant, and the third-officer is a major (derived from the late-Medieval and Renaissance sense of sergeant-major as the title of what we now term chief-of-staff).
The different armed forces branches evolved in near complete independence for centuries, up to perhaps the early 1800's. Further, they do not and never have given a flying fig for the traditions of the other branches. Soldiers are superstitious, not withstanding their claims to the contrary, and fundamental traditions will never be changed except under either extreme duress or proof of inadequacy. In this case neither applies.
Further, you have missed that there is a third usage in many navies. While the rank of captain is equivalent to that of colonel in English-speaking armies and is usually reserved to officers commanding capital ships, the title of captain is held by the commanding officer (or C.O.) of every naval vessel of any size, even when commanded by an officer of lesser rank. Those officers are fully entitled to be addressed as "Captain" while aboard and commanding their vessel.
Usage of the term company (originally free company) as a team of armed and trained men - led by a captain, a lieutenant, and various sergeants led by a sergeant-major - dates back at least to the mercenary troops of the Late Middle Ages and Renaissance. These units were of indeterminate size, the Company of the Hat for example being at least 1300 men at one point; the limit being the leadership and business skills of its captain. As they came with their own command structure and were independent, i.e. free to come or go, it became standard for a commander to think in terms of the company as the deployable unit.
In the late 15th century the Swiss Pike Square company - a 10x10 array of trained pike men - proved the decisive capability of pikes on the battlefield of the time as well as the importance of precision drill. Over the next three centuries independently deployed companies of pikemen were replaced: first by mixed-arms battle groups - battalions - comprising companies of pikemen, halberdiers, swordsmen, arquebusiers, musketeers, grenadiers and others drilled to complement and support each other; and then by battalions comprising companies of slot-bayonet equipped fusiliers.
At each stage of this development the unit size that could best combine effectiveness and maneuvre speed while maintaining the dense concentration of manpower and weapons to repel cavalry was the company of roughly 100-200 men. This is not to say that generals deployed companies as a tactical unit - just the opposite. It was a battalion's ability to adopt a wide variety of formations with its (usually) 6 to 8 well-drilled companies that allowed a general to simply deploy battalions, and allow each to manage its own self-preservation and effectiveness:
Common Napoleonic-Era Infantry Battalion Formations
Note how the company remains the largest maneuvrable dense grouping of men in any of these formations. Once whole battalions of companies packed densely together, as in a closed column, maneuvering became impossible without loss of order and control.
A loose order formation of men, as many abreast as the road bed could support and each rank 5 or 6 feet from the next, designed to optimize march speed. Extra distance between each company eased supervision of the men and provided a means for offers and NCO's to switch sides of the roadbed without disturbing the formation.
The formation in which a battalion expected and planned to give battle -except where the terrain might be so constrained as to force a narrower formation. Most armies formed line in three ranks except the British who formed in four (Not two, as British oversize battalions could not form square fast enough from an extended two-rank line. Only late in a battle, with opposing cavalry mostly hors du combat, would the British form two-rank lines to maximize firepower for a coup de grâce.)
(Battle) Column (Specified by Frontage and Interval)
A full interval column can form line to either left or right by a simple wheel of frontage unit (whether company or division), and also forms square quickly. In particular a French Full Interval Column by Division (upper left in the diagram) formed line to either right or left, or square, in the time for a Division (of two companies) to march one interval.
Square(s) - Both Hollow and Closed
The closed column could be formed very quickly against enemy cavalry, but unlike the hollow square preferred by the French, British and Prussians was effectively immobile.
Military Studies by Marshal Ney
Note that in the French infantry of this time each company - the administrative unit - comprised just a single platoon (peloton) as its maneuvre unit. Similarly in the artillery the battery was the gun tubes, carriages, limbers, etc. while the men servicing said equipment were a company of artillerists. Once the battery and artillery company had been united, on campaign or maneuvres, the combination might be referred to by either term.
On Skirimishing by Général de Divison Morand (1811)
Note below the emphatic instruction on training the troops by company, rather than to train a small number of men taken from each company.
We recognized that it was generally harmful to take a certain number of men by company, for flankers and skirmishers, and that it was preferable to take entire companies.
The companies of voltigeurs who are elite companies, cannot always perform this role without serious inconvenience, it has, therefore, appeared appropriate to me that in the case of the companies who could be used for the role, are trained for it.
As it is important for the sake of uniformity that there is some method to adopt, I send you, my dear General, a summary of the manoeuvres that I invite you to train the regiments under your orders to do, whether of light infantry or of infantry of line. I want us to benefit from the present season for training the troops.
Finally, I believe these answers provide additional useful background on how and why modern infantry ranks and organization came to be.
What should I call bands of armed men in the Middle Ages?
Covers a couple of additional points on the origin of a company as a body of men led by a captain.
What were the ranks in the Army of Imperial Spain?
Covers, among other aspects, how the medieval title of sergeant-major became the three modern ranks of:
A non-commissioned (but usually if not always warranted) rank;
A senior commissioned officer rank; and
A two-star general officer rank below the three-star rank of Lieutenant General even though a Lieutenant is usually thought of as less senior than a Major.