The answer is mutation of genes. The mutations were beneficial and gave the individuals of the population advantage and hence increased their survival. The classic features of birds evolved one by one and gave birds advantage over their dinosaurs counterparts, especially the feature of small size.