Although this question has often been asked jokingly, it is occasionally posited in rhetorical fashion by anti-evolutionists who use this apparent conundrum as “proof” that the Theory of Evolution is flawed. In fact, it is the premise of the question that is flawed, and not evolutionary theory.
Evolution is not a linear process in which one new species evolves to “replace” the old one, as the question implies. Instead, it is a much more complicated process in which new species generally arise by branching from an original line of ancestors. Separate branches then evolve along different trajectories, the outcome of which may include radical change, minor change, no change, or extinction. Survival of a particular evolutionary line is dependent upon the ability of its members to live and reproduce in their environment. Where evolution produces species that are in direct competition with each other, the species that is better-suited for survival will often “win out” and replace the other. However, species often evolve characteristics that allow them to occupy specific niches, in which they exploit environmental resources in different ways. Thus, two or more branches of the evolutionary tree may continue to coexist and co-evolve. Changes to the environment, such as Ice Ages, also influence the course of evolution, creating new niches in which new species are able to thrive. Both of these ideas are illustrated by the evolution of mammals from reptiles. A few mammal species were able to coexist alongside reptiles during the Age of Dinosaurs, despite having evolved from them. However it was environmental change, in the form of global cooling, that allowed mammals to flourish, and displace reptiles as the dominant class of large terrestrial animal. Nonetheless, reptiles persist on Earth, including some, such as crocodiles, that have changed little since ancient times.
This brings us to the central flaw in this oft-quoted rhetorical question. Evolutionary biologists do NOT make the argument that humans evolved from any modern apes we see on Earth today. Instead, they make the assertion that humans and modern apes, such as gorillas and chimpanzees, evolved from a common ancestral line that diverged as much as twenty million years ago (by some estimates) or about five million years ago (according to others). Early human-like ancestors were able to survive because they were better adapted to grassland environments, which were becoming more widespread at the time, than were the ancestors of modern apes, which were predominantly tree dwellers. Thus, there is no implication that any species of ape must have become extinct for humans to survive. Unfortunately, popular misconceptions about evolution, and not the real science of the theory, have led to misunderstandings such as those exemplified by the question above.