Our immune systems evolved over billions of years from the simplest organism. The first immune system to develop was the innate immune system. This is found in worms and plants. This is the system than simply reacts to all injuries in the same way. A good example would be if someone hits your arm, you will have pain and swelling mediated by your innate immune system. The adaptive immune system reacts differently to different threats to your body. The adaptive immunes system is only found in animals with a spine called vertebrates.
Most of our adaptive immune system is located around the small intestines where the foods eaten and the bacteria can activate a specific immune response when needed. The stomach acid destroys most invading bacteria, but if one should get through then special immune cells called dendritic cells will identify the bacteria or the allergic substance and travel back to the immune cells outside the intestine launching a specific immune response against that allergic substance or bacteria. The body also remembers the identity of the invader and can launch an immune response more rapidly if ever challenged again.
Maintaining a healthy immune system is important to your health. If you don’t eat the right foods, your immune system may not work as well as it should. Protein, healthy fats, healthy carbohydrates, vitamin C, vitamin A, Vitamin D, and colorful fruits, vegetables and spices have all been shown to affect immune function.