You have to eat a lot of carrots or pumpkin to have your skin turn orange, but it can happen. It is because of the beta-carotene, a pigment that is present in high amounts. If you eat too much, the excess beta-carotene enters the bloodstream. It is not broken down and instead, is deposited in the skin (it eventually breaks down though, and the skin returns to its normal color). The official medical term for this condition is carotenemia. It is a common and mostly harmless condition in infants, usually appearing when the infants begin to eat solids (carrots or sweet potatoes tend to be one of the "first vegetables" we give to babies).
Of course, this answer might lead you to other questions, such as what is beta-carotene?
Beta-carotene is a "carotenoid" found in many types of plants, but very enriched in those that are orange or yellow. It is thought to protect cells against oxidative damage and also is converted into vitamin A inside the body. In fact, beta-carotene is often thought of as an actual form of vitamin A. Having normal levels of vitamin A is key for good vision, strong immunity, and general health.
Carotenemia is a great example of the consequences of consuming too much of a good thing!