Evolution perspective - phagocytosis

Phagocytosis

As species evolved and became larger and more sophisticated some turned to eating other species. Thus the predator - prey relationship started.

The initial predators developed an elastic body (cell) wall that could engulf the prey species. Specialized cell organelles and chemicals would then attack the prey and dissolve it so it broke down to manageable food particles.
A prime example in today's world is the amoeba.

This ability, called phagocytosis, is also used as a defense mechanism in more advanced species. If a species is big enough it can spare cells to defense. It is also very well possible that rather than re-inventing phagocytosis more advanced species started symbiontic relationships with existing primitive predator cells, providing them with a safe habitat and sufficient food in exchange for killing off invaders.

This line of defense also still exists today in cells like macrophages and granulocytes.