James and Oliver Phelps are best known for playing Fred and George Weasley in the Harry Potter movies. They, like so many other actors in the films, spent more than a decade of their lives with these characters, putting together an amazing collection of eight films. Fred and George Weasley are a nearly inseparable duo in the books and movies, that it becomes intentionally difficult to tell the two of them apart. And it seems the twins were seen as such a unit in the movies that the Phelps brothers were not hired individually to play specific roles, but simply hired together to play Fred and George. And initially it wasn't even decided who would play who.
The Phelps brothers have their own podcast, Normal Not Normal, where the twins interview various people including their co-stars in the Harry Potter franchise. In the most recent episode, the two speak with Evanna Lynch, who played Luna Lovegood, and the actress asked them how it was decided who would be play Fred and who would play George. As it turns out, the decision wasn't made until essentially the last minute, as five minutes before the first script read through, the brothers needed to know whose lines they should read. James Phelps explained...
Just before the first read-through, and we’re talking five minutes before we’re supposed to start, we still had no idea who was Fred and who was George. So we asked Janet Hudson who was the main casting director. 'Who’s Fred and whose George?' And she said ‘You’re kidding. Good one.’
It seems that basically nobody had considered the question of which brother would play which brother. Even the casting director didn't really know the answer. So she then had a brief conversation with the people in charge, the director, the producer, and, of course, J.K. Rowling herself. James continues,
You saw Janet walk around to the other side and there was J.K. Rowling, David Heyman, and Chris Columbus... They look at each other, have a little discussion. We’re talking 20 second discussion if that. And then, Janet walks back around and says ‘Right, ok, James you’re Fred, Oliver you’re George.’
To this day, the Phelps brothers have no idea exactly what was discussed for that 20 seconds or what the determining factor was in deciding who was Fred and who was George. They both basically assume it was randomly decided. At the same time, as Evanna Lynch points out, Fred and George are not perfectly identical characters, so perhaps there was some discussion of which one would be best suited, in whatever minor way, for which character. It wasn't their age, as Fred was the older twin in his family, but James is the younger one in his.
Of course, there's also the question of the fact that while Fred and George go through nearly identical story beats throughout the franchise, their fates are not the same. Only the first four books had been published by the time that Harry Potter and the Sorcerer's Stone was being made. But one has to wonder if J.K. Rowling had a clear idea of what would happen to the Weasley brothers, as this decision basically determined who would survive the films, and who would not.