Well if someone had a bee in their bonnet (Bonnet as in old style hat), they'd probably be quite agitated and flustered and not concentrating on anything else. This phrase descibes someone behaving in this way.
As long ago as the 1500s, to have "a head full of bees" meant to have some fantasy, eccentric whim or craze. The "bonnet" version did not appear until about 300 years later, though it still meant the same...to be 'nuts' or obsessive about something as in "She's got a bee in her bonnet about litter" or "He's got a bee in his bonnet about real ale" or whatever.