Ancient history

Why did they build their city in the middle of a swamp?

The premise of your question contains an incorrect assumption. There are no ancient cities built in the middle of swamps. Swamps are generally not suitable locations for human settlement due to the presence of water, mud, and disease-carrying insects.