From a modern scientific perspective, the chicken came first because the genetic recombination that produced the first "chicken" (though that may be an arbitrary definition in a breeding population undergoing speciation) occurred in germ-line cells in a non-chicken ancestor. Another literal answer is that "the egg" in general came first, because egg-laying species pre-date the existence of chickens. To others, the chicken came first, seeing as chickens are merely domesticated red junglefowls.
In nature, living things evolve through changes in their DNA. In an animal like a chicken, DNA from a male sperm cell and a female ovum meet and combine to form a zygote -- the first cell of a new baby chicken. This first cell divides innumerable times to form all of the cells of the complete animal. In any animal, every cell contains exactly the same DNA, and that DNA comes from the zygote.
Chickens evolved from non-chickens through small changes caused by the mixing of male and female DNA or by mutations to the DNA that produced the zygote. These changes and mutations only have an effect at the point where a new zygote is created. That is, two non-chickens mated and the DNA in their new zygote contained the mutation(s) that produced the first true chicken. That one zygote cell divided to produce the first true chicken.
Chickens, as a species, became chickens through a long, slow process of evolution. At some point, a chicken-like bird produced an offspring that, due to some mutation in its DNA, crossed the threshold from mere chicken likeness into chicken actuality. That is to say, a proto-chicken gave birth to a real-life official chicken. And since that real-life official chicken came out of its own egg, we can say that the egg came first.
Another way to look at the question would be to ask which came first in evolutionary history. Once again, the egg takes precedence. Many characteristics of the modern avian egg—namely an oblong, asymmetrical shape and a hardened shell—were in place before birds diverged from dinosaurs about 150 million years ago. "A lot of the traits that we see in bird eggs evolved prior to birds in theropod dinosaurs," says Darla Zelenitsky, of the University of Calgary.
Another key moment in the history of avian eggs occurred at least 150 million years before that, when a subset of four-limbed vertebrates evolved to produce amniotic eggs. The embryos within the eggs were surrounded by three fluid-filled membranes that provide nourishment, protection, and a way to breathe. The earliest amniotic eggs contained large amounts of yolk, says James R. Stewart, a reproductive physiologist at East Tennessee State University. "You still see that in birds, crocodilians, and snakes," he explains. Like other placental mammals, we humans lost our yolk somewhere along the line, but our eggs still come with a vestigial yolk sac.