Ontogeny is all events that took place and occur during the existence of a specific living organism while phylogeny is the history of the evolution of a particular organism or a group of organisms of the same species.
“Ontogeny recapitulates phylogeny” is the foundation of recapitulation theory. Recapitulation theory posits that the development of individual organisms (ontogeny) follows (recapitulates) the same phases of the evolution of larger ancestral groups of related organisms (phylogeny).