Many phrases are wrongly ascribed a nautical origin just because they sound like mariner's lingo. This one really is and, like many such nautical phrases, it originated in the days of sail.
To get a sense of the original meaning of the phrase we need to understand the nautical terms 'by' and 'large'. 'Large' is easier, so we'll start there. When the wind is blowing from some compass point behind a ship's direction of travel then it is said to be 'large'. Sailors have used this term for centuries. For example, this piece from Richard Hakluyt's The Principall Navigations, Voiages, and Discoveries of the English Nation, 1591:
"When the wind came larger we waied anchor and set saile."
When the wind is in that favourable large direction the largest square sails may be set and the ship is able to travel in whatever downwind direction the captain sees fit.
'By' is a rather more difficult concept for landlubbers like me. In simplified terms it means 'in the general direction of'. Sailors would say to be 'by the wind' is to face into the wind or within six compass points of it.
The earliest known reference to 'by and large' in print is from Samuel Sturmy, in The Mariners Magazine, 1669:
"Thus you see the ship handled in fair weather and foul, by and learge."
by and largeTo sail 'by and large' required the ability to sail not only as earlier square-rigged ships could do, i.e. downwind, but also against the wind. At first sight, and for many non-sailors I'm sure second and third sight too, it seems impossible that a sailing ship could progress against the wind. They can though. The physics behind this is better left to others. Suffice it to say that it involves the use of triangular sails which act like aeroplane wings and provide a force which drags the ship sideways against the wind. By the use of this and by careful angling of the rudder the ship can make progress towards the wind.
The 19th century windjammers like Cutty Sark were able to maintain progress 'by and large' even in bad wind conditions by the use of many such aerodynamic triangular sails and large crews of able seamen.