If I am not mistaken, scientists believe that birds are evolved from reptiles. Why do the ancestors of birds (that is, reptiles) still exist?
Introduction to phylogeny
Short Intro to Speciation
Let's talk about speciation. Speciation is the process by which a single lineage split into two. This happens in a number of ways (allopatric vs sympatric vs parapatric, BDM model and others). I will consider a simple case of allopatric speciation below as it is the simplest one to understand (although not necessarily the process causing most speciation events).
Following the story of a lineage through its speciation events
Think of a population at time $t=0$. Let's call this species
Ancestor). Imagine that an ecological change brings a barrier right in the middle of the range of this population of
A. Such a barrier could be originally caused by a fire, or a river that has changed direction or a mountain range "popping up". The two now isolated populations are free to diverge randomly through time. This is what we call a speciation event. Note that under this model, there is no necessary need for selection to explain speciation. Let's call the two diverging population
C which exist at time $t=1$.
C goes under another speciation event and split into the populations
E. In the same time, population
B may have changed quite a bit so that we might want to call them
F. Here is a diagram of the situation
F D ----- E t=2 | | B ------------- C t=1 | A t=0
A is an ancestor of
F and does not exist today.
B is an ancestor of
F but does not exist today.
C is an ancestor to both
E and does not exist today. Let some more time pass by and you may eventually end up with the following tree
G ----- H K I ----- J t=3 | | | F D ----- E t=2 | | B ------------- C t=1 | A t=0
At time $t=3$, only species
J exist today, the other are ancestors of current species. Let's expand this tree even further.
L ----- M N O P ----- Q t=4 | | | | G ----- H K I ----- J t=3 | | | F D ----- E t=2 | | B ------------- C t=1 | A t=0
You will note that lineage
I went extinct at some point between $t=3$ and $t=4$.
Naming subsets of the tree
I am now suggesting to give a generic name for all the lineages present in the tree we drew (which we call a phylogenetic tree by the way). Let's call them Reptilia. So all the species
Q are Reptilia.
Birds and Mammals
Now let's consider a subset of this tree. Let's consider the subset made of the species
Q only. Let's call them birds. Let's also call mammals the subset composed by the species
Lizards (and others)
Finally let's call lizards all reptilia that are not birds, nor mammals (in reality it would be more correct to call this group lizard_crocodile_turtles_snake_amphibians_tuatura). Of course, the right tree is much bigger! By the way, you can explore the tree of life yourself on OneZoom.org.
What is a taxon
By the way, a group of species is called a taxon (plur. taxa).
It might be straight forward to you that there is something fundamentally different between the groups that we called mammals, birds and reptilia to the one that we called lizards. Indeed mammals, birds and reptilia are called monophyletic as they are composed of a given ancestor and all its descendants. lizard on the other way is not monophyletic. A monophyletic taxon is also called a clade. Below is a graph representing what a monophyletic taxon is. It also uses the terms polyphyletic and paraphyletic to describe different types of non-monophyletic taxa
Concept of species
You might want to learn more about the issues behind the concept of species in the post How could humans have interbred with Neanderthals if we're a different species?
Concept of taxonomic ranks
What we decide to call a class, an order or a family is also somewhat arbitrary too. For example, we generally consider the monophyletic taxon Mammalia is a class. However, there is no non-arbitrary reason for calling Mammalia a class rather than Eutheria (eutheria = placental mammal).
I suppose the above answered a big part of your question. You will be able to read all of what I just wrote (and much more) on any good introductory course to evolutionary biology. Consider having a quick look at Understanding Evolution by UC Berkeley for example as @MattDMo suggested in the comments.
Issues in your post
There are issues in your post that cannot be addressed in a single post (another reason for you to follow a quick intro course to evolution). Below I consider your post piece by piece mainly to point to some issues
Terrible statement. By belief, we often refer to a non-justified belief, that is a belief about the world that is not justified (in science, the method of justification is called "the scientific method"). The statement, therefore, suggests that non-justified beliefs have a place in science while they don't. By being a little lose on the semantic, one could say that scientists "know" or they don't know but they don't believe without good reasons to believe.
that birds are evolved from reptiles
This is misleading (and it mislead you) because by "reptile" you think of a lineage that currently exists. Also, the expression "are evolved from" sounds very wrong. The expression "has evolved from" would be more correct.
evolution occur so that the organism can survive in the environment by developing new characters
This is wrong both in terms of the semantic (issue of causality when saying
so that) and in term of the definition of evolution. You seem to confound evolution with natural selection.
According to natural selection
Natural selection is a process, not an explanation. It is like saying "according to gravity". The semantic is wrong, you should say "according to the theory of gravity" or "according to the theory of evolution" (or eventually "according to the theory of natural selection").
According to natural selection, those with favourable variations will survive and those with unfavourable die
You seem to apply that statement to population-level fitness (which would be mainly wrong) rather than to fitness variance within a population.
Why do the ancestors of birds (that is, reptiles) still exist?
The ancestors of birds don't exist anymore. I hope that was made clear from the above explanations.
Why didn't they get eliminated by natural selection?
This sentence suggests that you do not really understand what natural selection is but this is a story for another time. You can learn about natural selection on Understanding Evolution by UC Berkeley.
Reptiles evolving from birds is an example of divergent evolution. This wiki article has more information. Essentially both birds and reptiles are still around because they both fill a niche. That is, birds and reptiles separated have a common ancestor, and at some point their evolution diverged. At that point, birdoids which better filled the "bird" niche had higher fitness, and reptiloids which better filled the "reptile" niche had higher fitness, so birds evolved to be more like birds, and reptiles evolved to stay reptiles.