Basil plants attract butterflies with their long flowering spikes. The butterflies sip the nectar and in turn pollinate the plant. Many butterflies will also lay their eggs on basil plants so that their larvae will have leaves to eat when they hatch. These larvae are caterpillars and will later pupate and become butterflies.
Armyworms are caterpillars that feed heavily on basil leaves. These are caterpillars of nocturnal moths that lay hundreds of eggs at once on the undersides of basil leaves. Plenty of predators will eat up these caterpillars, but not if pesticides have been used heavily in the home garden. An army of armyworms can devour a basil plant or a stand of basil plants fairly quickly. Leafminers are caterpillars that worm about just below the surface of basil leaves and primarily cause cosmetic damage. They are truly detrimental only in very large numbers.
Bacillus thuringiensis is an organism that kills only caterpillars. Several dusts and sprays that contain Bacillus thuringiensis (also known as BT) are available commercially. These products may be applied to the basil plant while the caterpillar is feeding, causing it to stop feeding immediately then die within a few days. It must be reapplied if washed off by rain or irrigation.
Low levels of caterpillars are usually not much to worry about. Gardeners who enjoy butterflies understand that caterpillars are a tolerable nuisance for the joy of having butterflies in the garden. However, if BT is used in the garden, it will kill both butterfly caterpillars and pest caterpillars indiscriminately.