Wiktionary defines this as “the notion that an event in the real world was inspired by a creative work,” though I’ve always thought of it as more of an ironic comment that a real-life event happened to parallel a work of art.
Wikipedia has a more nuanced definition: a tradition in Irish writing sometimes traced to classical times, that “what is found in life and nature is not what is really there, but is that which artists have taught people to find there, through art… Its most notable proponent is Oscar Wilde, who opined in his 1889 essay The Decay of Lying that, ‘Life imitates Art far more than Art imitates Life.'”
The idea that we see what we are taught to see is fascinating. I have experienced the phenomenon of a search-image – that is, having previously seen an object makes it possible to “see” it again, from a praying mantis in a plant to a particular utensil in a drawer.
In an earlier reference, The Phrase Finder ties today’s phrase to another famous phrase: “The earliest actual usage of ‘necessity is the mother of invention’ that I can find in print is in Richard Franck’s ‘Northern Memoirs, calculated for the meridian of Scotland‘. Originals of this text are difficult to locate, but it was republished in 1821, with a foreword by Sir Walter Scott. The frontispiece of the reprint states that the original was “writ in the year 1658“. It contains this:
Art imitates Nature, and Necessity is the Mother of Invention.
1658 seems the best date we have as the birth of the phrase in English.”