whim (n.) Look up whim at Dictionary.com
1640s, "pun or play on words," shortened from whimwham "fanciful object" (q.v.). Meaning "sudden notion, fancy, or idea" first recorded 1690s, probably a shortened form of whimsy.