The sheer size of London requires the city to be divided into smaller areas of local government. Here are some maps etc. that illustrate how London's local government has developed over the centuries. All the images are thumbnails and can be enlarged.
Here is London's population (around 2020) compared with that of other English councils.
Local administration initially (and for centuries) was organised through parishes.
Official business would be carried out in the vestry - the room where parish records were kept. But parishes eventually had to have their own 'vestry offices' which eventually grew in size until the began to resemble modern town halls, Here is the Lambeth Vestry Hall in 1853. It can still be seen on Kennington Lane.
The associated parish of St Mary at Lambeth originally covered a huge area (mainly of countryside) from Lambeth Marsh and (what is now) Waterloo in the north down to Herne Hill in the south. The parish church (now the Garden Museum) is next to Lambeth Bridge. The parish was eventually split in 4 - St Matthews, Mark, Luke and John - in Brixton, Kennington, Norwood and Waterloo respectively. These were in turn eventually subdivided so as to create 30 Lambeth parishes.
It eventually became necessary for elected public authorities to take on the work previously carried out by the vestries. This led, by 1965, to there being 86 different authorities throughout what is now Greater London. (And the 86 exclude the ancient City of London - the white area in the middle of this map.)
The 28 Metropolitan Boroughs formed Inner London which had its own education system etc. The strange shape comes from the decision to exclude authorities to the east of the River Lea and north of the Thames (or alternatively to include the industrial boroughs of Greenwich and Woolwich)_.
Then, in 1965, it was decided to create 32 London Boroughs out of the 86 former authorities. Each borough was intended to have a population (then) of around 200,000 and to include diverse neighbourhoods, which explains why so many are so long and thin, and run north/south, and so include the industrial areas near the Thames as well as 'leafy suburbs'. There were nevertheless many arguments over the new councils' boundaries and names, amusingly described in Jay Foreman's two videos: Why does London have 32 Boroughs - and - What's Wrong with London's Boroughs?
London remains a hugely diverse community - or rather a huge number of diverse communities. But the division into boroughs almost certainly helps monitor and if necessary plan to address inequalities.
Finally, for completion, here is a map of London's Parliamentary constituencies, each of them smaller than the boroughs. (And - yes - it contains a typo ...)