Think of big cities like managers. They don't produce any products, so you might conclude that they're a waste of money.
Likewise, cities have their place in a countries economy, even if it's not to directly produce goods and driving up the GDP per capita.
In even simpler words: Remove Berlin from Germany and the GDP of the rest of the country would also go down.