As it turns out, flowers were the incidental result of a genetic defect.
Defects or mutations in plants happened rarely but given that there are so many plants, it was enough to give plants the opportunity to diversify. Plants that had a defect would either have an advantage or a disadvantage to other plants. It may help them grow taller to get more light, or excrete a scent to attract pollinating insects, or expand their roots to find more food and water. Those that had an advantage, would survive and reproduce its new genes in more plants. Those that didn’t have an advantage or which genes would actually become a restriction would die and never spread their genes. All of these genetic defects would be completely accidental, so it wouldn’t be a particular plants fault for having this deviation. Think of it as a computer that starts up fine 1000 times and then just one day, without explanation, it has a hissy fit and doesn’t start up. It’s happened to all of us whether it’s been our computer/laptop, phone, television or anything. When that happens the plant doesn’t complain or throw its toys out of the pram, it just takes what it has and does the best it can with it.
You very often see animals including humans born with defects, sometimes these can be minor things that can be lived with, or these can be very life restricting diseases or illnesses. When any biological creature, plant or animal, is brought into this world with a defect it never seems fair that they had to have it, but it is nature’s way of experimenting. It determines how a race or genus can excel and thrive rather than merely survive, it goes back to Darwinian discoveries by explaining how things adapt to their environment.
As for the creation of flowers, it was the genetic defect of plants that would tend to bunch their leaves at the tops of their stems. This was possibly where the plant could extract the most light for photosynthesis. These plants clearly did well and out competed their fellow plants around them because of their ‘advantage’. Then after more genetic interfering the leaves at the top began to lose their green colour as the chlorophyll made way for other pigments of a more attractive and vibrant nature. These more colourful leaves developed into more of a floral structure along the way and often also developed fragrances.
As time has gone by, each generation will have improved a little bit until the next accidental defect comes along and that plant will have to see if it can survive or even outperform its companions. For example, the fragrances would have developed into a scent that attracts the local pollinators. Then one plant would have a genetic defect and either have a more or less attractive scent. The more attractive scent would win out and be pollinated over the others. Then that plant would spread its genes and the cycle would go on.
But it wasn’t until flowering plants began to work with pollinating insects, when the acceleration of plants evolution really took off.