"cross-tempered, irritable," 1807, from crank (n.) + -y (2). The evolution would be from earlier senses of crank, e.g. "a twist or fanciful turn of speech" (1590s); "inaccessible hole or crevice" (1560s). Grose's 1787 "Provincial Glossary" has "Cranky. Ailing sickly from the dutch crank, sick." and identifies it as a Northern word. Related: Crankily; crankiness.
Ben. Dang it, don't you spare him--A cross grain'd cranky toad as ever crawl'd. (etc.) [Richard Cumberland, "Lovers Resolutions," Act I, 1813]
Very irritable; touchy: The baby was cranky all day (1821+)