Apple lets you sync passwords via iCloud through a clever mechanism that keeps your secrets safe from all snoopers—including Apple. iCloud Keychain syncs passwords among all iPhones, iPad, and Macs associated with the same iCloud account for which Keychain is enabled in Settings > account name > iCloud (iOS/iPadOS), the iCloud preference pane (Mojave or earlier), or the Apple ID preference pane’s iCloud section (Catalina or later).
However, when you log into an iPhone, iPad, or Mac with a fresh install, on a new device, or with a new macOS account on a Mac, Apple will prompt you to enter the password or passphrase of one of your other devices. This might seem a bit like malware when you first see it—partly because you can’t find a match for the text that Apple displays on Apple’s support site—but it’s a natural consequence of how Apple protects your data securely without having access to your passwords.