This is debunked with little reference on Snopes. It is claimed there that the origin of the myth was deliberate misinformation to hide the use of a game-changing technology used by the RAF to shoot down German planes. This claim regarding the propaganda origin is sourced a bit better at the Wikipedia article on one of the officersWikipedia article on one of the officers.
The grain-of-truth (which probably helps perpetuate the myth) is mentioned in the Snopes article as well and partially backed up at the (archived) CDC article on carrots that they link to:
Beta-carotene, which is found in the vegetable, may help reduce the risk of cataract and macular degeneration. However, it needs be pointed out that studies which have posited this link used doses of Vitamin A or beta-carotene that were higher than what is found in the standard diet. It would be quite difficult to eat the requisite number of carrots to match this level of intake. Also, among those who suffer a Vitamin A deficiency, nyctanopia (also known as nyctalopia or night blindness; the inability to see well in poor light) can be at least somewhat helped by adding carrots to the sufferer's diet.