cookie (n.)

"small, flat, sweet cake," 1730 (Scottish); 1808 (American English); the U.S. use at least is from Dutch koekje "little cake," diminutive of koek "cake," from Middle Dutch koke (see cake (n.)). Slang application to persons (especially an attractive woman) attested since 1920. Phrase that's the way the cookie crumbles "that's the way things happen" is from 1957.