Once again, chance and happy accidents are central to narrative: a random mutation lead to the evolution of feathers selected for warmth, and by chance those feathers turn out to be useful for flying, particularly after they’ve been modified to create an airfoil.
It is incredible to me how nature is. We start getting used to how we are and then with our nature we start changing and adapting. In the beginning we don’t get it, but then we realize that nature knows what it is doing. We may think that evolution may be for one reason, but nature is always one step ahead of us. It does not only change species for one reason, but because of what might come ahead too. For examples, these feathers that came to be for one reason and then it helped them fly in a certain way.