Pus is formed at a site of infection and consists of a protein-rich fluid which is often yellowish white in color.
This is caused because the immune cells that reach the site of infection, die and build up in the area.
These immune cells include neutrophils and macropahges.
When there is an infection, these neutrophils and macrophages reach the site of injury as they are a part of the innate immune system to control the infection and then when they die and if not cleared from the site of the infection, then a build-up of pus occurs.