That's rather unusual. Broccoli usually gets flowers when the heads are old and the plant has "bolted". At this stage the broccoli can be woody or bitter.
Is it broccoli or possibly broccoli rabe? Broccoli rabe gets small heads and the flowers become visible as the head is developing. Cut it and eat it when it is young.