Originally,giraffe did not have a long neck. It had a very short neck and thus was unable to eat leaves from trees,since it's a herbivore. But then,just like the evolution of man, the giraffe also evolved and eventually began to grow a long neck and eat from big trees.
Charles Darwin was the first person to give the concept of evolution.
I hope I am able to help.