The image refers to an idyllic world where everything's fine and perfect, but it is not like that in real life. Here's an interesting account of how the phrase came into usage:
It's not all rainbows and butterflies, you know. Or rainbows and unicorns. Or butterflies and unicorns. But when it comes to referring to impossibly perfect conditions where everyone's happy and nothing goes wrong, we're living in a golden age of RBUs.
A Google News search brings up almost 500 hits for rainbows and unicorns or rainbows and butterflies. On Ngram you can see that both expressions, as well as butterflies and rainbows, are on the rise, with rainbows and unicorns in particular shooting steadily up since 2003.

Rainbows and butterflies came together first. The earliest attestation I've found is from an 1864 book by Jenny d' Héricourt (translated from French) titled A Woman's Philosophy of Woman, where on pages 191 and 192 we read:
...if [women] were free and happy they would be less eager for illusions and cajoleries and it would no longer be necessary in writing to them to place rainbows and butterflies' wings under contribution…
It's butterfly wings instead of entire butterflies, but the sentiment seems the same. The phrase also occurs in William S. Lord's 1897 poem Jingle and Jangle, which lists some things that the pleasant sound of a jingling bell brings to mind:
Sunshine and sugar and honey and bees,
Rainbows and butterflies wings,
Bird songs and brook songs and wide spreading trees,
Of joy little Jingle bell sings.
Butterflies and rainbows also appears in the late 19th century, in an 1896 editorial that scornfully refers to the idea of moving the U.S. to a dual gold-and-silver standard as "chasing free silver butterflies and rainbows."
Pairings of rainbows with butterflies (not just butterflies' wings) continue to appear on into the 20th century, often as the objects of chasing, before the steady rise in the graph that began in the 1970s. Since then, "rainbows and butterflies" has been the title of a 1983 song by Billy Swan, the title of two books of poetry, and part of the lyrics of Maroon 5's 2005 song "She Will Be Loved."

In the 1980s, unicorns made their entry, at around the same time that Hasbro began marketing its My Little Pony line of toys, which included both a Rainbow Ponies and a Unicorn Ponies collection. However, I can't claim that this event was the you-got-your-chocolate-in-my-peanut-butter moment for rainbows and unicorns; it may be that an increasing popularity of unicorns was responsible for both phenomena.
A 2010 post on the Zandl Marketing Group's blog puts the increasing popularity of rainbows and unicorns in the context of the mainstreaming of gay cultural symbols. In any case, in the mid-80s we begin to see examples like this one from 1984:
The only calendars left in the stores just before the holidays are those with unicorns and rainbows on them. [Orange Coast Magazine]
Although unicorns arrived late to the party, they've hit it off so well with rainbows that for some, it's not enough just to have the two words conjoined by and. In the past few years, unicorns that fart rainbows seem to have become their own meme. For an even tighter linkage, there's Lady Rainicorn, a half-rainbow, half-unicorn character in Cartoon Network's Adventure Time series.
Rainbows and unicorns: A linguistic history by Neal Whitman, February 26, 2013 on theweek.com