Innate behavior

Have you ever wondered how a dolphin knows how to swim instantly after being born. Or how birds know where to migrate and how bears know when to hibernate. Well this is known as innate behavior or instinct.

Innate behavior are in full capabilities the first time it happens. Even if the animal has had know previous experience with stimuli to which it responds. Reproduction, migration, hibernation, these are all examples of innate behavior.

Some of the simplest things are examples of innate behavior. Such as an adult female mammal nurturing its newborn offspring. Other forms of it can be very complicated. A spider spindling its web is actually a form of innate behavior.

All innate behaviors are dependent upon mechanisms inside that are created from interactions between an animal's genes and its environment. Biologists are still baffled as to how these kinds of interactions occur. My hypothesis is that possibly the memories from an animal's ancestor is encoded into the ancestors genes. The memories are then passed down through the genes of an animal giving it "genetic memories".
How do fish and other water creatures know how to swim when first born?