Plants produce flowers for the purpose of reproduction. Flowers contain both male parts, which produce pollen, and female parts, which produce ovules. When combined, pollen and ovules create seeds and help to create the next generation of plants.
Plants have to go about reproduction differently than animals because they are unable to get into the same space as another plant. So plants evolved different ways to help them move pollen between plants of the same species. Some plant species use clouds of pollen and the wind to get a few grains of pollen where they need to go. Other plant species use insects, such as bees, to move pollen around for them.
Bees are attracted to flowering plants by the smell of the nectar within those plants. The bees take the nectar back to their hive where honey is made out of it. To get the nectar, a bee must dig deep inside a flower, and in the process, it gets covered in pollen. The bee then flies to another flower and spreads the pollen from the first flower to the second. Hopefully, some of the pollen from the first flower lands on the stigma of the second, which takes the pollen to an ovule. Once fertilized, the ovule becomes a seed.