An allergy occurs when a person's immune system (specifically mast cells in the lining of the airways) becomes sensitised to a harmless substance, most commonly pollen (hayfever), dust mite faeces (some forms of asthma), or nuts. After becoming sensitized, when the substance next enters the person's body, the immune system responds as though it were a pathogen, releasing histamines, which causes the affected area to become inflamed. The intensity of this reaction can vary from a mild rash, up to inflammation so bad it can cut off your breathing and choke you to death

It is thought that the original function of the part of the immune system (antibodies called immunoglobin E) was to combat parasitic worms such as tapeworms, in the developed world, as that doesn't happen very often, the cells become sensitised to harmless substances.