The word 'cockpit' seems to have been used as a nautical term in the 17th century, without reference to cock fighting.

It referred to an area in the rear of a ship where the cockswain's station was located, the cockswain being the pilot of a smaller "boat" that could be dispatched from the ship to board another ship or to bring people ashore.

The word cockswain in turn derives from the old English terms for "boat-servant" ('coque' is the French word for "shell"; and 'swain' was old English for boy or servant).

The midshipmen and master's mates were later berthed in the 'cockpit', and it served as the action station for the ship's surgeon and his mates during battle. Thus by the 18th century, 'cockpit' had come to designate an area in the rear lower deck of a warship where the wounded were taken.

In an airliner, the 'cockpit' is usually referred to as the flight deck, the term deriving from its use by the Royal Air Force (RAF) for the separate, upper platform in large flying boats where the pilot and co-pilot sat. In the US and many other countries, however, the term cockpit is also used for airliners.

More Info: en.wikipedia.org