I believe feathers evolved from scales. I think they were first beneficial for dinosaurs for their likely elaborate courtship/mating rituals if birds are any indicator of how other dinosaurs found mates.
Early feathers weren't useful for flying, keeping warm or making a creature look bigger, so I would figure the advantage that made them useful was related to mating.
Early feathers weren't useful for flying, keeping warm or making a creature look bigger, so I would figure the advantage that made them useful was related to mating.