Short answer: sometimes, but not as a simple yes. In many cities, ordinary sidewalk trash cans are left unlocked because they are meant for small litter and need to be easy for everyone to use. You are more likely to see locking mechanisms on larger public bins, bins in high-traffic or high-dumping areas, or smart bins that require a card, code, or a staff key.
The “lock” can take different forms. Some urban trash cans have keyed locks that only sanitation workers can open. Others use self-closing flaps, narrow openings, one-way openings, or sensor-controlled lids to limit what people can put in. These designs are not always about stopping household garbage; they also help reduce vandalism, scavenging, odors, pests, and overflow.
That said, locks are not a perfect fix. If a public bin is too hard to use, some people may leave household bags beside it, which can create an even worse mess. That is why cities usually combine bin design with public education, enforcement, bulky-waste collection, and better access to legal disposal options.
So, do urban trash cans come with locking mechanisms to keep people from dumping household garbage in them? Some do, and the number is growing in problem areas. But most cities use a mix of tools, and the right answer depends on the bin, the neighborhood, and local policy. If you are dealing with a specific bin in your area, the best move is to contact your local sanitation department and ask how that site is managed.