Bird actually evolved for flying dinosaurs and for these ancient dinos, evolving the ability to sly would have given them advantages over their prey. Birds have trained the wings, as having wings continues to give them advantages, mainly the ability to take to the sky.
Animals tend to live in a ‘niche’ or a place where they fit in the ecosystem. Birds find that have wings gives them a completely different niche, compared to animals who don’t have wings, helping them survive and prosper.