Largest city and capital are different jobs
A capital is where the government sits. That is a political decision, and it is frequently made against the commercial and cultural centre rather than in favour of it. Countries choose smaller cities for balance between regions, for defensibility, for neutrality between rival populations, or simply because a leader decided to build somewhere new.
So the instinct that produces the wrong answer is not ignorance. It is the perfectly reasonable assumption that the most important city is the capital, which happens to be false surprisingly often.