Nasturtiums are a beautiful flower that also helps repel insects. It's good to plant around your squash and cucumber, helps keep squash bugs away, but also in other beds helps repel flies, aphids, etc.
Any of the aromatics, lavender, rosemary, mint, yarrow, tansy, etc tend to keep insects away.
It's not what we traditionally think of as flowers, but onions, chives, garlic are very good to scatter through your garden to keep pests away. The chives do make a nice ornamental flower, also.
If you plant geranium somewhere AWAY from your veggies, it will draw Japanese beetles to it, away from the veggies. It's supposed to be attractive to the JB's but also toxic to them.