There are two main types of larvae that can be found in an apple, including the codling moth and apple maggot. While other types of worms or larvae can be found in apples, they are normally found in the core whereas these two are found in the fleshy part.
Worms appear in apples after adults of the species lay eggs in the fruit. When hatched, the larvae begin to feed on the fruit, causing it to bruise and decay before falling to the ground. In most cases, apple worms will not vacate the apple until all of the above has occurred.