Turtles are probably anapaid reptiles, meaning they are descendants of the earliest branch of reptiles to have evolved. They are called anapsid because they have no temporal opening in their skull.
Another branch of reptiles is synapsid. The synapsids include such well known fossils as Dimetrodon, which has a sail-like frill on its back. Synapsids are now extinct, except for one branch that led to the ancestor of mammals. Synapsids have a single temporal opening in their skull. Mammals, including humans, are the descendants of synapsid reptiles.
Another branch of reptile is known as diapsids, and they have 2 temporal openings in their skull. Living diapsids are lizards, snakes, crocodilians and the tuatara. The ancestor of birds was also a diapsid, but it belongs to a special group of diapsids known as archosaurs, or ruling reptiles. Archosaurs include crocodiles and dinosaurs. That means the closest living relative of birds are crocodiles and alligators.
Dinosaurs are not a well defined group. There were 2 great groups of dinosaurs, known as saurischians, or lizard-hipped dinosaurs, and the ornithischians, or bird-hipped dinosaurs. Many modern scientists believe that both groups of dinosaurs share a common ancestor but some of the greatest paleontologists who ever lived do not think so. George Gaylord Simpson and A. S. Romer both think that the 2 groups of dinosaurs evolved independently of each other. About the only similarity between these 2 groups of dinosaurs is that they evolved from ancestors that walked on 2 legs. The 4 legged dinosaurs evolved from ancestors that walked on 2 legs.
Dinosaurs evolved in the late Triassic and they were the dominant land animals for over 150 million years. Then 65 million years ago, a giant meteor the size of Mt. Everest struck the earth at high speed. The impact was the equivalent of 1 billion atomic bombs exploding all at once. The earth's atmosphere was heated to oven-like temperatures. All dinosaurs, and all enantiornithine birds were wiped out by the hot temperature. Even many mammals were wiped out. The survivors were either animals that were spending a lot of time underground (e.g. invertebrates, lizards, snakes, toads, shrew-like mammals and multi-tuberculates or rodent-like mammals), or they spent a lot of time in the water (e.g. aquatic animals, crocodiles, frogs, turtles shorebirds and the platypus). They survived because heat rises, so temperature underground was cool enough to allow them to survive. Temperatures in or near the water was also cool, since water takes a lot of energy to heat up.