Why did evolution create a chicken that lays so many unfertilized eggs when that is so wasteful?

Prolific egg-laying chickens have been created by humans through hundreds of years of selective breeding. Public domain image, source: Christopher S. Baird.

Natural evolution did not create a chicken that lays so many unfertilized eggs. Human engineering created such chickens. You could call the process "human-caused evolution", "artificial selection", or "selective breeding". The evolutionary principles of survival of the fittest and inheritance of genetic traits still apply in artificial selection, but the agent that determines who is the fittest is a human and not a natural environmental pressure. In selective breeding, humans choose only the individuals of a species that have desirable traits to use as parents for the next generation. After several generations of selective breeding, the organism gains more and more of the desired trait. It's not that the humans are training or teaching the organism to have the desired trait. Rather, genetic mutations cause the next generation of individuals to have a variety of new traits (the "new traits" are typically very small modifications when looking at just a single generation). Most of the mutation-caused traits are undesirable or irrelevant. But the few organisms with desirable traits are selected and used to create the next generation.

Organic-food purists may think of words like "unnatural", "unhealthy", and "toxic" when confronted with genetically-modified food. But the fact is that all of our agricultural food has been genetically altered through thousands of years of selective breeding. It does not take a modern biotechnology lab to genetically optimize food for human consumption. All it takes is a farmer choosing the seeds from the juiciest apples, or the hen that lays the most eggs as the progenitor for the next generation. Perhaps without realizing it, humans have been genetic bio-engineers ever since the dawn of agriculture through selective breeding. After many generations over hundreds of years, domesticated chickens have laid more and more eggs per year as a result of humans selecting for this trait. All of the agricultural foods we eat, from wheat and rice to beef and milk, are far more nutrient-rich, delicious, and prolific than their ancient, wild predecessors because of human intervention.

The next question is perhaps, "Why do chickens lay unfertilized eggs at all?" The reason is that the egg is mostly developed before being fertilized. The chicken cannot know in advance whether the egg will end up fertilized or not, so it just has to go ahead and grow the egg in the hopes that it will be fertilized. In the wild, this system works well because mating among fowls is common and most eggs do end up fertilized.