For millions of years, the Earth was covered with ferns and pine trees and moss and mushrooms, without any flowers, grass, or fruit. But about 360 million years ago, near the end of the Cretaceous period, some of these pine trees developed a new way to scatter their seeds that turned out to be very successful - not just cones anymore, but flowers and fruit.
These flowering plants needed extra energy to make flowers and fruit instead of cones. They got that energy by making less pollen than the conifers made. Conifers, which have only the wind to spread their seeds, must make huge amounts of pollen to make sure some of it gets to the eggs to fertilize them (one of the main causes of hay fever is all that pollen in the air). Flowering plants use bees to pick up the pollen instead, so they can save energy by making less pollen. They use that energy to make beautiful flowers to attract the bees.
But no matter how good an idea flowers were, it would have been impossible for them to evolve any earlier than they did, because flowering plants needed bees to land on them and carry their pollen from flower to flower, and until the Jurassic period, just before the Cretaceous, there weren't any bees. Bees and flowers evolved together, and they are symbiotic - bees can't live without flowers, and flowers can't live without bees.
When we think of flowering plants we mostly think of flowers like daffodils or dandelions. But flowering plants also include big trees like maples and oaks and apple trees and walnut trees, and bushes like blackberries and rhododendrons, and they even include all of the grasses like wheat and barley and nettles and plain grass that grows on your lawn. All of these are flowering plants, and they all evolved during the Cretaceous period, in the last days of the dinosaurs.
To find out more about flowering plants, check out these books from Amazon.com or from your library: