That's mostly because of London's financial center, where a lot of foreign money is laundered; the city's GDP is comparable in size with small EU countries like Belgium or Ireland. If you take London out of the equation, what's left has an average GDP of only 30k per capita [0].
A quick comparison with [1] (using 1 GBP ~ 1.30 USD) shows that London would rank #8 in Europe (between Denmark and Norway), while the rest of the UK would come in somewhere around #25, between Spain and Italy.
[0] https://www.statista.com/statistics/1168072/uk-gdp-per-head-...
[1] https://en.wikipedia.org/wiki/List_of_sovereign_states_in_Eu...