Hi Sadiebaby! Eating carrots was an old propaganda tale spread during WWII as Ratter15 says.
Basically, in the early years of WWII, British and German bombers flew over each others territory at night almost with impunity. That was because no radar had been developed that was small enough to fit into a nightfighter. There was a desperate race at the time between Britain and Germany to find the secret of doing so. Britain won the race when we invented something called the cavity magnetron which enabled a very small radar set to be built.
The RAF started fitting the secret new radars in their nightfighters and we suddenly started to shoot down huge numbers of German bombers at night. However, we didn't want Germany to realise that we had probably discovered the secret of building a small airborne radar. They would then launch an all-out attempt to steal the secret with their spies in this country.
It was therefore decided by the British government to explain the sudden huge losses by announcing that RAF fighter pilots had started eating huge amounts of carrots which then enabled them to see in the dark! It was swallowed hook, line and sinker by most people here and it still persists today.
The Germans weren't that gullible though and they guessed the reason for the massive increase in their losses. It wasn't long before they captured a set from a shot down RAF fighter and built their own version.
Sorry to bore you - but that's the reason.