The primary difference is that a city attorney is more like a corporate attorney who does some non-criminal prosecution and a district attorney is a criminal prosecutor who focuses almost exclusively on that work.
A city attorney is the lawyer who represents a city as a corporation in a wide variety of matters. While some city attorneys prosecute cases in court, those cases are non-criminal and only a portion of the city attorney's responsibilities. Some city attorneys are full-time employees and others are retained through private law firms, but each city pays for its own attorney regardless of whether the person is an employee or retained counsel. By statute, city attorneys handle all the "law business" of their cities, so much of what a city attorney does is not necessarily listed in a statute. Every city should have at least a part-time city attorney, but some larger cities may have full-time deputy and assistant city attorneys as well (for example, West Allis has 4 attorneys). A city attorney only focuses on that city.
A district attorney is a criminal prosecutor who primarily handles the charging and prosecution of crimes that occur within that district attorney's county. Each county in the state has its own elected district attorney with the exception of a shared office between Menominee and Shawano County. A district attorney can also hire deputy and assistant attorneys, but the state employs all district attorneys, deputies, and assistants instead of the county in which they work (with a few exceptions for special prosecutors). The district attorney has very specialized duties laid out in state law and is responsible for all municipalities in the district attorney's county.
Click here to visit the Milwaukee County District Attorney's website.