Carrots do not give you better night vision. The myth was spread around by British forces trying to hide the radar!
Lack of Vitamin A can worsen your night vision. However, it is an urban legend that eating a lot of carrots will allow you to have superhuman night vision. Here's the crazy story of how this rumor became so widespread.
Between July 10 and October 31st 1940, Germany attacked the United Kingdom in what was called the Battle of Britain. It was the first major battle to be entirely fought in the air. Germany wanted to destroy the British air defenses and get them to surrender. However, the British were able to defend themselves quite effectively thanks in a large part because new Radar techniques had been discovered. Radar was such an advantage, that the Royal Air Force wanted to keep it a complete secret. The solution? Carrots.
During World War II, British gunners spread the rumor that eating tons of carrots was what allowed them to shoot down German planes in the darkness of night. They were trying to cover up any discovery of the radar they had in their hands. The rumor proved somewhat successful as it reinforced German folklore. It also encouraged Britons to improve their night vision by growing and eating more carrots.