When you eat carrots, the beta-carotene is transformed into retinol or vitamin A. Carrots are high in Vitamin A, and a deficiency in this nutrient can cause some difficulty seeing in dim light. Vitamin A is essential for the formation of the chemical retinal, whose presence in the retina is necessary for vision. Our eyes have two kinds of light sensitive cells: the rods and the cones. The rods are the cells we rely on to see in dim light. They are sensitive to Vitamin A deficiency, because it can cause a shortage of retinal.
The retina is the light-sensing part of the eye that holds the rods and cones, which contain enzymes that absorb light and allow us to see. When light strikes the retinal molecule, it changes its shape. This activates a cascade of chemical reactions that informs the brain that light has entered the eye. When the levels of light sensitive molecules are low, due to Vitamin A deficiency, there will not be enough retinal to detect the light at night. During the day there is enough light to produce vision, despite low levels of retinal. So it's only night vision that can be improved by eating carrots.