For one, the exact origins are unknown. the earliest record we have is from 1067 CE with the William Charter [1]. William granted the City rights in exchange for not attacking and the City recognizing him as King, which this article sort of mentions. But the interesting part is that William was simply recognizing the rights of something that already existed. For how long? Nobody knows. It's likely somewhere in the 7th or 8th century when Anglo-Saxons resettled the previously abandoned Roman walled city of Londinium after their departure in 410 CE.
It's also fascinating because it's managed to survive for nearly 1000 yaers since then, largely recognizable from its earlier form although there have been various changes and reforms. There have been efforts to disband it too but obviously they failed.
It also survived uncertain times like the Vikings would cojme along every now and again and burn down London Bridge.
London's development as a financial center goes back to 1066 too and a key part was likely due, at least in part, to the arrival of Jews during William's reign [2].
Why was this important? Well, Jews were prohibited from charging interest to other Jews. Muslims and Christians had similar constraints. But an oddity of Judaism was that Jews could charge interest to non-Jews [3]. This later likely contributed to conspiracy theories about Jews (eg blood libel) and antisemitism.
So ancient civil institutions like the Court of Aldermen still exist and certain rights given to the Freemen of the City of London still exist, like the ancient right to bring sheep in to the City over the bridge [4].
[1]: https://www.cityoflondon.gov.uk/things-to-do/history-and-her...
[2]: https://en.wikipedia.org/wiki/History_of_the_Jews_in_England...
[3]: https://en.wikipedia.org/wiki/Loans_and_interest_in_Judaism
[4]: https://www.euronews.com/culture/2022/09/27/unbaalievable-sh...