The density comparison is unfair. The US density is low too if you include the farmland and the mountains and deserts. Aukland's density of 3,400 per sq mile is the same as where I live in Chicago, but our rate of infection is over 10 times higher. Manhattan is, of course, one of the densest cities in the developed world.
I think you're getting hung up on density when that's not really the salient detail. IMHO the NZ response was successful in large part because they controlled entry. They're already a pretty isolated island, but very early on they routed all ingress traffic through Aukland (although most of it already ran through there), and started quarantining and monitoring everyone entering. This allowed them to clamp down on the initial infection, which meant that the high compliance with distancing/stay-at-home was highly effective.
Plus, it's really a pretty small country - it's pretty comparable to Colorado in both population and area, but even then Aukland metro is noticeably smaller than Denver metro - roughly half the size. This means that overall they are pretty spread out even if there are small-ish pockets of higher density. Controlling entry + engaged populace + relatively low density = pretty good recipe for control. Unfortunately a pretty unique situation so maybe not one that we can look to as an example to follow - very very few places can control and monitor entry as well as NZ