Why do giraffes have long necks? Let's start with the misconception. The misconception states that giraffes reach high for leaves to eat and therefore their necks stretch during adulthood. It states that a single giraffe played a great role in giving giraffes as a whole long necks. Not true. The true answer is natural selection.
Giraffes have long necks due to natural selection. Over time, giraffes with longer necks had an advantage over giraffes of shorter necks. During times of food shortages, giraffes with longer necks are able to reach leaves (food) higher up. As a result, giraffes with shorter necks had a greater likelihood of dying before reproducing. Thus those giraffes that do survive and reproduce are more likely to have longer necks. The "long-neck" gene, if I may call it that, is passed to the offspring, making it more likely the offspring will have longer necks. Over several generations of giraffes, the number of short-necked giraffes decreased and the number of long-necked giraffes increased. A single giraffe is not stretching its neck and producing long-necked giraffes. It's natural selection at work effecting an entire species over many generations.
Natural selection isn't goal driven. Natural selection didn't have the goal of producing long-necked giraffes. As a result of environmental conditions, natural selection resulted in more long-necked giraffes as these giraffes were more likely to survive, reproduce, and more likely to have offspring with longer necks. There you go...now you know why giraffes have long necks. :-)