It is an established fact that in living organisms there is considerable variation between individuals of the same species. It is also established that individuals of a species, that are closely related, have many similarities. The differences between organisms are due to differences in their environment and genes.
Variations which are caused by environmental influences, do not affect the next generation as they are not inheritable. For example if somebody trapped their hand in a food blender, and pulverised it beyond all recognition they would not pass the shredded hand on to their offspring.
Variations which are due to genes can be inherited, and these are the variations which drive selection. Genetic variation occurs due to mutation of genes. It is important to realise that this is random. Centuries ago people would say statements like "Giraffes grew long necks to reach food high up in trees". This statement implies the change was for a purpose. A more modern way of expressing things would be to say "Random mutation caused some giraffes to grow long necks, these giraffes then were able to feed on food high up in trees".