We are constantly covered in pathogens (harmful bacteria, viruses or microbes). Without our wonderful immune system any single one of these would kill us pretty fast, but we thankfully have this team of microscopic assassins that identify and eliminate threats to our body.
Before something can get into our body it first either has to permeate the skin and mucous membranes, both of which are specialized surfaces of our bodies designed to keep pathogens out.
Sometimes, however, they do get in and for this there are two types of immunity. Innate or non-specific immunity responds to all pathogens in the same way, it shows no difference when confronting a virus compared to bacteria. All animals have this, however only vertebrates have acquired or adaptive immunity. This is where the body learns the ways to recognize and defeat a pathogen should it come back. This is the science behind vaccinations.
From Crash Course: Biology on YouTube presented by Hank Green.