The story
Evoking the image of roosters, who ruffle their neck feathers when threatened. OED's earliest attestation is from 1829. Perhaps a variant of an earlier phrase "ruffle the tempers", attested since at least 1722.
Etymology from Wiktionary, CC BY-SA 4.0.