Perhaps 350 million years ago, the first amphibians crawled out of the primordial seas. They had legs, so they could move on land, and they could breathe air, at least in maturity, but otherwise they much resembled their fish ancestors. (Modern tadpoles still look like fish to a child.) They were born in water, and spent their larval stage there; only moving to land after metamorphosis gave them their adult form. Modern amphibians still depend upon water to keep their skins moist, and still reproduce (with the exception of damp-loving salamanders), in water, where their young are born and develop.
More than 300 million years ago, during the early Carboniferous Period, the first known reptile, Hylonomus, was born. It had no larval stage, but began life as a miniature adult. It was small, and resembled modern lizards. It's believed Hylonomus lived on insects, which were colonizing dry land at about the same time this first reptile was. Its fossil remains have been found in Nova Scotia, in petrified tree stumps where it might have once sought food or shelter.
It was the evolution of the amniote egg that allowed reptiles to be born on dry land. A leathery or calcified shell protected the egg's contents, while allowing oxygen and carbon dioxide to move in and out. Meanwhile a series of inner membranes kept the developing embryo moist, as it floated in amniotic fluid. It is the presence of these membranes that makes a reptile an amniote. It was as if the pre-birth reptile were still bathed in the nurturing sea. Also, the yolk contained food for the developing animal.
Mammals are also amniotes, of the synapsid lineage. Mammal evolution diverged from that of the reptiles with what are now called the stem-mammals, so that mammals are really descended from early amphibians, not from true reptiles, though early mammals were reptile-like. Of course, almost all mammals now bear live young.
Birds, on the other hand, are amniotes of sauropsid lineage. The Sauropsids are the true reptiles, and so are the birds. So birds are in fact descended from reptiles. In fact, some scientists say birds are reptiles.
The first reptiles, though, lived on land, but swampy land, and in competition with amphibian species. It was not until the end of the Carboniferous period, with a short ice age, that reptiles grew huge.
The period known as the Age of Reptiles began. Dinosaurs dominated for 160 million years. From late in the Triassic to the great extinction at the end of the Cretaceous, seventeen orders of reptiles filled niches in every biome and ruled the earth, the seas, and even the skies. Only four orders remain today. They are Sphenodontia, represented only by two species of lizard-sized tuatara which live on small islands near New Zealand; Squamata, the lizards and snakes; Crocodilia, crocodiles, alligators caimans and gavials; and Testudines, the turtles, tortoises, and terrapins. Those orders, of course, and the birds remain.
No one knows, as yet, what caused the great extinction of the dinosaurs. There are geologists who make a very good case for a giant impact event that quickly changed conditions enough to cause a mass extinction. More exotic theories exist, and may even be correct, but for now, it is generally believed that a giant asteroid, or something that caused equal atmospheric havoc, ended the Age of Reptiles.