Somebody asked me earlier today why a penis is also called a cock. I assumed that it had something to do with the rooster (the male chicken) being called a cock. While this is true, there's a little bit more to tell. Here's a brief investigation into the matter.
According to Etymonline:
Slang sense of "penis" is attested since 1610s (but cf. pillicock "penis," from c.1300);
Cassell's Dictionary of Slang provides a good explanation of cock's etymology based on a couple of generally reliable sources (OED, Eric Partridge):
Lat. cuccus, the male domestic fowl; thus the term has been used for any object that resembles a cock's head. As far as the sexual term is concerned, cock here mixes the basic image of the cock as a rooster (itself a 19C US euph.) and the cock's head seen as a tap-like shape, this secondary aspect emphasized by its function in 'pouring' semen. The word remained in perfectly standard use until Queen Victoria's coronation, shortly after which it joined the ranks of taboo. It has yet to return to the mainstream. Note that E.P. claims 'always SE but since 1830 a vulgarism' and OED (in late 19C) notes 'the current name among the people, but, pudoris causa not admissible in polite speech or literature'.
The above is confirmed to an extent in the following excerpts.
From The Lover's Tongue: A Merry Romp Through the Language of Love and Sex by Mark Morton:
The penis sense of prick has persisted to the present-day, as has another penis word that arose in the early seventeenth century, cock. That word had, of course, existed in English before it came to denote the penis. Since at least the ninth century it had been used to identify a male domestic fowl. The extension of the word from bird to penis might have been inspired by several things. First, when a rooster-or cock-becomes excited or aggressive, the wattles and caruncles and comb on its neck and head fill with blood, causing those fleshy lobes to swell and brighten in colour. A penis, as you may have witnessed or experienced, responds in a similar manner when the man to which it is attached becomes aroused, which might have prompted the transference of the name from rooster to organ. Alternatively, the word might have been transferred in a more indirect manner: first, the name of a spout found on barrels came to be known as a cock, or stop-cock, due to the fact that the top of such spouts were often shaped like a cock’s comb so that they could be grasped and turned off or on. The resemblance of such a spout, pouring forth beer or wine, and the human penis, pouring forth what used to be beer or wine, might have inspired the extension of the barrel cock to the male member.
Many of the other cocks in present-day English derive from the same source as the penis cock. For instance, the stance in which a rooster crows-with its neck arched and head tipped back-prompted the word
From Sex: A User's Guide by Stephen Arnott:
It’s thought that the slang word cock for “penis” is taken from the word cock as in “male chicken." Since the cock-chicken is masculine, upright, and randy, it’s not hard to see how the connection was made. The origin of the name is believed to be onomatopoeic and derived from the bird’s familiar wake-up call. The word cockerel is of fifteenth-century origin and was originally a diminutive meaning “small cock.” In the 1770s the Puritans, embarrassed by the earthy-sounding cock, started calling cocks “roosters,” a name derived from the term roast cock.
To summarise, it is unknown exactly how this meaning of the word came about, but the prevalent theories indicate it to stem from either or both of cock's meanings as a male fowl as well as a tap/faucet. While most sources state that the word originated in the early 1600s, if one considers the existence of pillicock circa 1300 CE, this meaning might have been around for many years before then.
It might also be worth noting that according to Cassell, cock can also mean vagina in Southern Black dialects.