Mutations in individuals leads to variation in a population of a species. Some individuals have characteristics that makes them better suited to their environments, so they are more likely to survive and reproduce to pass on their genes that increased their survival to the next generation.
This is called 'natural selection' or 'survival of the fittest'. Think about why giraffes' necks are so long - a longer neck means they can reach up tall trees to get more food, increasing their survival chances. Changes in an entire species' characteristics can take many generations and hundreds and thousands of years. In giraffes, shorter-necked individuals were more likely to die, so the proportion of longer-necked individuals increased until all giraffes have really long necks.