Several flowers are so called. Red Bachelor's Buttons, the double red campion; yellow Bachelor's Buttons, the “upright crowfoot”; white Bachelor's Buttons, the white ranunculus and white campion.
“The similitude these flowers have to the jagged cloath buttons anciently worne ... gave occasion ... to call them Bachelour's Buttons.” —Gerard: Herbal.
Or else from a custom still sometimes observed by rustics of carrying the flower in their pockets to know how they stand with their sweethearts. If the flower dies, it is a bad omen; but if it does not fade, they may hope for the best.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894
More on Bachelor's Buttons from Fact Monster: