From the OED....
cockpit
• noun 1 a compartment for the pilot and crew in an aircraft or spacecraft. 2 the driver’s compartment in a racing car. 3 a place where cockfights are held.
— ORIGIN from COCK + PIT1; sense 1 derives from an 18th-century use denoting an area in the aft lower deck of a ship where the wounded were taken, later coming to mean the opitc or well from which a yacht was steered.