Well, allergies are developed over time, usually... most people who become allergic to things like bees, did so because they were stung many times and got progressively worse.
Not sure how to explain things like allergies to peanuts in young children though.
I think I read somewhere that peanut allergies are developed in-utero or through mother's milk. I don't know why either, but I've heard that pregnant or nursing moms shouldn't eat them. Allergies like that are just so bizarre and scary. Penicillin allergies are especially scary because they can crop up at any time. Any penicillin should could be your last.