When your city gets attacked and if the attacker's troops walk into the defense range of the Command Center, your troops in the city will fight back automatically.