Before chickens were domesticated, they were grey, and harder to spot. As the years went by, people started breeding them so they would produce more meat, better flavor, etc. As they bred them for those traits, it happened that they accidentally produced the "yellow" trait, too, which wasn't a big deal since chickens by then were all on farms, not out in the wild.