Kevin Feige was asked this in an interview with Cinema Blend and gave the below response. Essentially it’s about not judging the book by its cover and looking into what makes a hero. He goes on to explain that like with everything we know neither race are going to be 100% good or bad.
I think subverting expectations is always fun, and I think breathing reality and life and emotion and pathos into characters you wouldn't expect to have those attributes is also fun, and a good way of storytelling... I think '90s and Fury, of course, Carol Danvers, of course the Kelly Sue [DeConnick] run, and Goose, sort of came together, and then the notion of [good Skrulls]. Because this whole movie is about who can be a hero. Who should be a hero? What does a hero look like? What does it mean to be a hero? And it felt like additive to that theme to do what we did with Talos. And Ben Mendelsohn's the greatest.
People have asked, 'Oh, so are they all good?' And I'm like, 'Is anybody all good?' So that's part of becoming dimensionalized characters. [The capacity for them to be bad is still very much out there], as it is - for better, for worse - for all of us.
Cinema Blend, Kevin Feige Explains What’s Happening With The Skrulls After Captain Marvel
Anna Boden, the director, elaborates a bit on this in the DVD commentary but mainly seems to talk about the twist not why they did it.
"This is another one of those scenes, you know, besides the one you mentioned before Ryan, the scene that we shot at dusk, that’s kind of the heart of the movie to me," Boden said. "She kind of finds her humanity in that scene. Carol finds her humanity in that scene and we really see the humanity of the Skrulls in this scene and it’s like these pointy eared weird looking shape shifting aliens that we assumed were the villains for the first half of the film and to like open up our hearts and see that they have families and they care about the same things that we care about, that was one of the really exciting things about this movie us and Jonathan Schwartz and Kevin Feige and Lou (D'Esposito) and Victoria (Alonso) and Geneva (Robertson-Dworet) who we’re writing with all got really excited about and really wanted to bring to this movie. Taking these Skrulls who’re like the villains from the comics and being able to see another side of them, and then her reckoning with warring with these people who she didn’t understand and was fighting on the wrong side of the war"
ComicBook, Captain Marvel Directors Reveal Why They Made Skrulls the Good Guys