They like to even up the ratio of girls:boys & evenly distribute the trouble-makers & volatile characters like DS2.
How badly doesn't he get on with the lad? Would your DS start throwing pencils if other lad moved his paper? There was a lad in DS2's yr who reacted like that.
Some kids work better firmly in their comfort zones some work better being challenged. Don't just think about English-maths, there's all the topic work & PE & art & PSHE they don't want to feel stressed out in. DS2 kicks off if paired up with bossy girls.
They can get it wrong, obviously.
I find with DC school that they mix the kids up again for subjects like maths (the kids literally move around between classrooms), so it's not like they learn in fixed groups at all just depending on who is their nominal teacher. DD (quite good at English) is paired with a boy who is kind of lousy at English, in the hope that both will benefit. They are same yr group, anyway. I can't say for sure about academic effects, DD pushes herself in English anyway. Otherwise it has helped them get on better socially (bit of a history).
DD was split from her best mates for y4 & miserable about it (same mates are now her worst enemies, but that's a different story, liable to change next week!). The worst thing was a new rule came in that they HAD to sit with their own class for lunchtimes. That really cut down on her social time with the (supposed) BFF. You might want to check on lunch rules.