The origin of "pipe dream" has to do with opium smoking and dates back to the 18th and 19th centuries. The dream-like visions or flights of fancy known to occur under the influence of opium came to be called "pipe dreams," referring to the opium pipe.
From Drugs To General Usage
The expression took off in late 19th century in American English in cities where opium dens were appearing, especially Chicago. Chicago newspapers began using the term more generally to mean something unrealistic or fantastic; something you hope for but don't think would actually occur.
Expressions that come out of modern drug use can become so common that we can use them without evoking the images of drug use.
Interview has been edited for clarity
Produced by Arwen Nicks.