First line of wikipedia > Immune system
> The immune system is a host defense system comprising many biological structures and processes within an organism that protects against disease
First line of wikipedia > Allergy
> Allergies, also known as allergic diseases, are a number of conditions caused by hypersensitivity of the immune system to typically harmless substances in the environment.
In other words, the immune system is here to defend the organism against diseases. However, sometimes this immune system misinterprets a harmless substance and start triggering an immune response against it. Such immune response against harmless substance is called an allergy. An allergy is hence a defect of the immune system. There are other defects of the immune system though, such as autoimmune diseases.