Originaly the term comes from cock fighting ( as still customary e.g. in the Philippines). Two roosters, with metal blades attached to their feet, are set against each other in a pit (or a circular cage made of wood, but open on top for the spectators) to prevent them from running away.
This term was later used for sailing dingies and yachts, you sit on the sill and put your feet into the cockpit, while handling the tiller and the sheet.
Since many aviation traditions derive of maritime traditions (see the white hat of PanAm pilots), the term cockpit was taken over in aviation for the place from which you control the plane.
Je Suis Charlie et je suis Ahmet aussi