Why was "tantrum" trending last week?
1703, American English, from Dutch koekje "little cake," diminutive of koek "cake," from Middle Dutch koke (see cake (n.)). Slang application to persons attested since 1920. Phrase that's the way the cookie crumbles "that's the way things happen" is from 1957.
A collection of information, usually including a username and the current date and time, stored on the local computer of a person using the World Wide Web, used chiefly by websites to identify users who have previously registered or visited the site. Cookies are used to relate one computer transaction to a later one.
The ticket you get from a dry-cleaning shop is a perfect mundane example of a cookie; the only thing it's useful for is to relate a later transaction to this one (so you get the same clothes back).
Compare magic cookie; see also fortune cookie.