How can a new iPhone know the names of people in my photos?
The name data comes down from iCloud document and key-value-store sync. Even if you don’t use iCloud to store photos, metadata about photos does sync by default. This is similar how to small settings sync between devices. Apple could handle it like screen time where you explicitly opt in or out of this per device, but as of Big Sur and iOS 14 there is no granular opt in or out for this.
Apple doesn’t generate the names, you do on your phone or the iPad / web / macOS version of photos app and then Apple remembers it in your encrypted data store. The “identities” are all machine generated and one “person” can match several machine “matches” in practice.
Until you tell your device to forget that name or that face, that label is attached to the “identity” in the synced data store attached to your iCloud storage bucket.