True in most countries. The president or more generally the chief of the executive often has legal immunity. It makes sense because that are the law, at least in part.
In democracies there a usually some protection against abuse of that power (ex: impeachment).
You're conflating a president (highest executive) with a monarch. Perhaps on purpose given current goings on, but a key distinction between monarchies and democracies is explicitly that all people in the country are subject to the same laws and there is no sovereign immunity.
The Monarch also needs permission from the Mayor of the City of London to enter the city, so we do need to make a distinction between de jure and de facto law here.
> It is sometimes asserted that the Lord Mayor may exclude the monarch from the City of London. This legend is based on the misinterpretation of the ceremony observed each time the sovereign enters the City at Temple Bar, when the Lord Mayor presents the City's Pearl Sword to the sovereign as a symbol of the latter's overlordship. The monarch does not, as is often purported, wait for the Lord Mayor's permission to enter the City. When the sovereign enters the City, a short ceremony usually takes place where the Lord Mayor presents a sword to the monarch, symbolically surrendering their authority. If the sovereign is attending a service at St Paul's Cathedral this ceremony would take place there rather than at the boundary of the City, simply for convenience.