In the US a city is a government of a municipality. Every city has a governing body that levies taxes, plans infrastructure, pays emergency services, handles code requirements and enforcement, and can pass laws. For example, many cities have a ban in place on burning trash. That ban is enforced by the city law enforcement and applies within city limits. Another example is in Colorado when weed was leagalized by the state several cities made it illegal to open a recreational dispensery in city limits, so anyone wanting to tap into that customer base had to set up their opperation in the surrounding county (county is usually a large square of land that includes cities under it and has less regulation than the city, so burning trash is legal in most counties and anyone living outside the city, but in the county may do so) counties have Sheriffs who enforce the law and can have various non-city entities that do things like run a fire department.
Its all kinda complicated but baisically you have the following governments in the United States: Federal Government (laws for the whole country) -> State Government (laws for the state, baisically a small country, they do actually have their own militaries tax collectors etc...) -> County Government (a large portion of each state that often includes several cities handles mostly crime that happens outside cities, infrastructure, and fire regulations but can do more depending on the state. I think a few states have Bouroughs or some other name for these entities, but same idea) -> City Governments (laws for the city, zoning, sales tax in the city [on top of the state sales tax] law enforcement in city limits, and a bunch of other stuff)
There are exceptions and edge cases like municipal governments that aren't cities exactly and other odds and ends. Which makes law in the US complicated, for example you could get in trouble for having a knife that's legal one town over, but you visited a friend in a city where it's illegal. Lots of other odds and ends, like reporting purchases made out of state so you can pay your states sales tax on that etc...