The story of butterfly evolution is incomplete; butterflies are inherently so delicate that their remains are very rarely preserved there’re therefore several gaps in our knowledge. Insects first made an appearance about 400 million years ago, having evolved from the same ancestral line as the spiders and centipedes. This was back in the Devonian period, in the Paleozoic era. Winged insects made an appearance soon after; somewhere around 50 million years later; during the Carboniferous period. Moths evolved before butterflies, but it is actually very difficult to say when. This is because they developed out of caddis-flies (Order Trichoptera), and there’s no single stage where they stopped being cadis-flies, and started being moths. Butterflies evolved about 40 million years later; during the Cretaceous period.
Finding a fossil butterfly is a very rare even less than 50 have been found to date, including those preserved in amber. The best fossil butterflies have been found at the Florissant Fossil Beds National Monument in central Colorado, which is world renowned for the quality of its fossils. The beds there produce fossils that are in the order of 35 million years old. The oldest conclusive lepidopteran fossil found, however was in England at Charmouth. This was a moth called Archaeolepis mane, and is from the lower Jurassic, which makes it about 185 million years old.
The evolution of butterflies was directly linked to that of flowering plants. This is because of mutual interdependence; the butterflies need the flowers to feed on, and the plants need the butterflies to act as pollinators. This is achieved when butterflies travel between flowers to feed. As they do so, they also transfer pollen; this is sometimes so specific that only one species of plant can feed the butterfly, and conversely the butterfly may be the only species that can pollinate the plant. The consequence of this is that if one becomes extinct, so does the other.