Feathers evolved before birds could fly. Birds evolved directly from the archosaurs, developing the internal temperature regulation that reptiles lack. Or possibly the avians evolved from dinosaurs that were direct descendants of the archosaurs, arising from theropods like Tyrannosaurus rex. Crocodilians like the American alligator definitely evolved directly from the archosaurs, and the genes to make feathers can still be read in alligator DNA, though they are never expressed.
So, birds are distant cousins of the crocodiles, in an evolutionary sense. They are archosaurs with wings and feathers, in the same sense that crocodilians are archosaurs with scales and teeth. The feathers of birds are adaptations of marvelous utility, good for insulation, waterproofing, camouflage, courtship display and flight.
Feathers are not essential to flight, though. Bats and insects easily fly without them. For this reason and others, scientists are inclined to believe that feathers did not originally evolve for the purpose of flight. If feathers began as signals or ornaments, they were useful even in a primitive state, before they could help birds soar. If they were insulation, they would be useful to a creature that maintained a temperature different from that of the environment. The fossil record provides ample evidence that feathers evolved before avian flight.
Archaeopteryx lithographica was a transitional creature. It is classed as a bird, but it also had features characteristic of dinosaurs. That is, it had feathers and the kind of big toe birds have, but it lacked a bill and had teeth like a dinosaur.
Archaeopteryx is found only as a fossil; it's as gone as the dinosaurs. It is reasonable to believe, however, that descendants of this bird are nesting today.
Other feathered creatures
Protoarchaeopteryx robusta and Caudipteryx zoui are feathered theropod dinosaurs discovered in China. They appear to have had both serrated teeth and plumage. These creatures could not have flown. Perhaps the turkey-sized Protoarchaeopteryx glided from tree to tree like a squirrel, and perhaps the peacock-sized Caudipteryx kept warm in a coat of proto-down. The feathers could have served as insulation and the remarkable wing and tail feathers as a courtship signal, like a modern peacock's fan.
Scientists reason that since these early feathers were useful for purposes other than flight, the force of natural selection did not discard them as the avians evolved. Through the eons, as the dinosaurs passed away and afterward, feathers evolved into asymmetrical soft armor, the tools of flight, as birds evolved to fly.
The tools of flight
Modern feathers served to bend the air stream and create lift, with one hard inflexible edge held firm by interlocked barbs, and one softer side to shape the slipstream of air. The feather has reached a near miraculous state of utility among the flying birds, but it began its evolutionary journey when birds walked, climbed or ran.
Some researchers believe the avians differentiated from among the archosaurs long before there were dinosaurs. Others believe that the first feathers were seen among dinosaurs. The genetic evidence indicates how feathers arose as a variation of scales. What were scales in crocodilians became proto-feathers and then feathers in birds. Whenever the change began, it helped those first flightless creatures to survive and prosper, so that their descendants would live to ornament modern skies.