Jean Baptiste Lamarck, a French biologist who had an alternate evolutionary theory of biology to that of Charles Darwin, explained that giraffes have long necks because as they reached for leaves in high branches of trees, their necks became longer and stronger. Their offspring, in turn, would inherit necks that were slightly longer.
Lamarck believed that evolution moved from simplicity to complexity in a continual upward progression. When species sufficiently evolved, they turned into other species, and when a trait, structure or organ was no longer needed, it would disappear. According to Lamarck, this was evidenced in the case of giraffes growing longer legs and necks through multiple generations to meet their food needs. Darwin, on the other hand, argued that animals with more efficient inherent traits would survive through natural selection, and that these animals would pass on the traits that helped them survive to their offspring. Lamarckism, or the theory of Lamarckian inheritance, is abandoned in modern evolutionary biology.
As of 2014, two main hypotheses account for the elongation of the necks of giraffes. One, proposed by Darwin and called the competing browser hypothesis, posits that giraffes evolved long necks to reach food inaccessible to other animals. The other idea, developed later than Darwin's and called the sexual selection hypothesis, suggests that the long necks evolved to aid male giraffes in fighting for the attention of females.