"sequence of sensations or images passing through the mind of a sleeping person," mid-13c., probably related to Old Norse draumr, Danish drøm, Swedish dröm, Old Saxon drom "merriment, noise," Old Frisian dram "dream," Dutch droom, Old High German troum, German Traum "dream." These all are perhaps from a Proto-Germanic *draugmas "deception, illusion, phantasm" (source also of Old Saxon bidriogan, Old High German triogan, German trügen "to deceive, delude," Old Norse draugr "ghost, apparition"). Possible cognates outside Germanic are Sanskrit druh- "seek to harm, injure," Avestan druz- "lie, deceive."
Old English dream meant "joy, mirth, noisy merriment," also "music." Much study has failed to prove that Old English dream is the source of the modern word for "sleeping vision," despite being identical in form. Perhaps the meaning of the word changed dramatically, or "vision" was an unrecorded secondary Old English meaning of dream, or there are two words here.
OED offers this theory for the absence of dream in the modern sense in the record of Old English: "It seems as if the presence of dream 'joy, mirth, music,' had caused dream 'dream' to be avoided, at least in literature, and swefn, lit. 'sleep,' to be substituted ...."
The dream that meant "joy, mirth, music" faded out of use after early Middle English. According to Middle English Compendium, the replacement of swefn (Middle English swevn) by dream in the sense "sleeping vision" occurs earliest and is most frequent in the East Midlands and the North of England, where Scandinavian influence was strongest.
Dream in the sense of "that which is presented to the mind by the imaginative faculty, though not in sleep" is from 1580s. The meaning "ideal or aspiration" is from 1931, from the earlier sense of "something of dream-like beauty or charm" (1888). The notion of "ideal" is behind dream girl (1850), etc.
Before it meant "sleeping vision" Old English swefn meant "sleep," as did a great many Indo-European "dream" nouns originally, such as Lithuanian sapnas, Old Church Slavonic sunu, and the Romanic words (French songe, Spanish sueño, Italian sogno all from Latin somnium. All of these (including Old English swefn) are from PIE *swep-no-, which also is the source of Greek hypnos (from PIE root *swep- "to sleep"). Old English also had mæting in the "sleeping vision" sense.