early 14c., "illusory appearance," from Old French fantaisie, phantasie "vision, imagination" (14c.), from Latin phantasia, from Greek phantasia "power of imagination; appearance, image, perception," from phantazesthai "picture to oneself," from phantos "visible," from phainesthai "appear," in late Greek "to imagine, have visions," related to phaos, phos "light," phainein "to show, to bring to light" (from PIE root *bha- (1) "to shine").
Sense of "whimsical notion, illusion" is pre-1400, followed by that of "fantastic imagination," which is first attested 1530s. Sense of "day-dream based on desires" is from 1926. In early use in English also fantasie, phantasy, etc. As the name of a fiction genre, by 1948.