The spelling cockswain, sometimes used, better indicates the source of the word coxswain.
Five hundred years ago a cock was a small rowboat, often called a cockboat.
Such a boat was usually carried on a larger vessel for the use of the captain, to take him ashore or the like.
And the swain in charge of that small boat, assigned to row the captain where he listed, was the cockswain.
With passing years the boat under his charge increased in size and, whether manned by many oarsmen or moved by sail, his prime duty was that of helmsman.
The corrupted spelling, coxswain, has been general since the seventeenth century.