ref
early 17th century (in the sense ‘caprice’): probably based on whim-wham.
Probably from whims + -y. Related to whim-wham, whim.
whimsy (n.)
c. 1600, probably related to whimwham.