The spelling of the word coxcomb, though common from Shakespeare’s time, conceals the source.
The original was cock’s comb, the comb or crest of a cock, and, back in the time of Queen Elizabeth I and later, it denoted the cap worn by the professional fool or jester, having the cut and color of such a crest, sometimes with small bells sewn to the tips.
The jester himself became the coxcomb, and, because of his foolish pretensions and conceits, it was not long before any man of like characteristics, any pretender, became a coxcomb in the eyes of his fellows.