Many insects have a life cycle in which the young stage is very different from the adult. The young stage is called a larva. The larva of the butterfly and moth is called a caterpillar.
The larva is a different form so that it can feed on different food from the adult and not compete with it. For example, the larva of the fly is the maggot. The maggot feeds inside decaying meat while the adult fly feeds on the surface. By not competing for the same food, large numbers of both young and adults can thrive in a single habitat.
The pupa is the stage between the larva and the adult. When a larva begins to change into an adult, it moults its skin and replaces it with a hard case. This case may be in the shape of a small cigar, as in the fly, or it may be larger and have an outline which helps camouflage it, as in some moths and butterflies. Inside the pupa the larva changes into the adult. Then the pupa case splits open and the adult climbs out. Many insects may spend the winter as pupae to avoid unfavourable weather.
The pupa of the butterfly is known as the chrysalis.