London was formerly in the county of Middlesex.
No, the City of London was not formerly in any other county - because it is both a city and a county in its own right. That's why it has its own Lord Mayor (not the Mayor of London) and its own police force (not the Met).
The census entry doesn't say 'City'. It's a partly erased clerical error, as several others have said.
Carol