Fun fact: apart from the main office SW1 they're alphabetised by area, from SW2 Brixton to SW19 Wimbledon. All of the London postcode areas are like this.
SW2 to SW9 are in alphabetical order: Brixton, Chelsea, Clapham, Earls Court, Fulham, South Ken, South Lambeth, Stockwell.
But then it starts again and you have to squint a bit for SW10-SW20: Brompton, Battersea, Balham, Barnes, Mortlake, Putney, Streatham, Tooting, Wandsworth, Wimbledon, West Wimbledon.
Looking at a few others (SE, etc) I see that the first chunk of them are in alphabetical order, but then they've added some extra ones later that break the ordering (e.g. SE19 onwards) but they have tried to add the extra ones in mostly alphabetical order too.
Yeah, they've become a bit muddled over the years but generally alphabetical in the batches they're added. E was nice and clean before the Olympics, then they added E20 for Stratford after E18 Woodford.
Most people assume it's relative to how far out the area is from the centre