Caterpillars are insects. They are the larval stage of butterflies and moths, which are flying insects. Caterpillars form pupae, within which they transform into butterflies and moths.
Insects have a complicated lifecycle. They hatch from eggs, but most insects do not resemble their adult form at the time of hatching. These insects, which include butterflies and moths, are called holometabolous. They undergo a complete metamorphosis from juvenile to adult forms.
The worm-like larvae that hatches from the egg of a holometabolous insect may be called caterpillars, maggots or grubs, depending on the species. They form pupae and then transform into their adult forms, which have the characteristic insect features of six legs, wings, three body segments and a hard exoskeleton.