To attract their 'own' pollinators.
Almost all flowers that emit a scent are pollinated by insects. It is beneficial for plants that pollinators, after visiting one flower, move on to another of the same kind.
In this way, pollen of the same species lands on the flowers, rather than foreign pollen.
To achieve this, flowers have characteristics that help insects distinguish them: shape, color, and, of course, aroma. Its composition may include substances that are attractive to the 'right' pollinators.