cock (n.1) Look up cock at Dictionary.com
"male chicken," Old English cocc "male bird," Old French coc (12c., Modern French coq), Old Norse kokkr, all of echoic origin. Old English cocc was a nickname for "one who strutted like a cock," thus a common term in the Middle Ages for a pert boy, used of scullions, apprentices, servants, etc.

A common personal name till c. 1500, it was affixed to Christian names as a pet diminutive, as in Wilcox, Hitchcock, etc. Slang sense of "penis" is attested since 1610s (but compare pillicock "penis," from c. 1300); cock-teaser is from 1891. A cocker spaniel (1823) was trained to start woodcocks. Cock-and-bull is first recorded 1620s, perhaps an allusion to Aesop's fables, with their incredible talking animals, or to a particular story, now forgotten. French has parallel expression coq-à-l'âne.
cock (n.2) Look up cock at Dictionary.com
in various mechanical senses, such as cock of a faucet (early 15c.) is of uncertain connection with cock (n.1), but German has hahn "cock" in many of the same senses. The cock of an old matchlock firearm is 1560s, hence half-cocked (for which see half).
cock (v.) Look up cock at Dictionary.com
mid-12c., cocken, "to fight;" 1570s, "to swagger;" seeming contradictory modern senses of "to stand up" (as in cock one's ear), c. 1600, and "to bend" (1898) are from the two cock nouns. The first is probably in reference to the posture of the bird's head or tail, the second to the firearm position. To cock ones hat carries the notion of "defiant boastfulness."