system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How are animals born with “instincts”? That is, how is it possible that newborn animals are born with the knowledge to do things like go to the water (sea turtles) or swim to a certain location to mate/eat (orcas)?
gpt
Evolution works because only the variations that work get a chance to reproduce and pass on their genes while the variations that are detrimental tend to die.

Baby sea turtles make a great snack for a lot of animals. Hatching sea turtles can go in any direction they want really. But the safest direction for them to go is the water.

Imagine thousands or hundreds of thousands of generations of sea turtle babies hatching year after year. Which ones have the best chance of survival? The ones attracted to the sea. They are the ones most likely to pass on the genes that gave them a preference for the sea.

The sea turtle babies that preferred to warm up in the sun a little likely all get eaten and don't pass on their genes.

A selective pressure like that will change animals over successive generations until the urge to make a run for the sea is very strong in all sea turtles. After all, the ones missing that urge never reproduced.

And not everything is simple instinct. Whales like orca's, often reproduce in very specific places because of their requirements. The reproduction of most animals is closely tied to the availability of food because reproducing is very resource-intensive for the parent and the young also need food.

So, in the case of whales, they're not instinctively driven to certain areas. They're instinctively driven to reproduce when they get the chance to glut on food. For orca's, that's when other whales, seals, penguins, fish etc. start to reproduce. Which in turn is often when the food for those animals start to reproduce.

Orcas tend to be very habitual. Different pods specialise in hunting different food sources. A pod can be traditional whale hunters, seal hunters or fish eaters despite all orca's being the same species. As such, they all share the instinct to reproduce when food is plentiful but where that is varies and is learned behaviour that young orcas pick up from their parents.