iCloud Keychain stores your Safari website usernames and passwords, credit card information, and Wi-Fi network information to iCloud, it syncs those saved data up to date across all of your approved devices. So that you can quickly and easily log into websites.
Follow these steps, you can easily setup iCloud Keychain on iPhone/iPad.
Step 1: Go to Settings > iCloud.
Step 2: Tap on Keychain, then turn on iCloud Keychain.
Step 3: Enter your Apple ID password to enable iCloud Keychain. That's all.
If you use two-factor authentication with your Apple ID, your device is trusted when you sign in. You won't need to approve your device separately to turn on iCloud Keychain.
If you setup iCloud Keychain for a new device without another device to approve from, or without two-factor authentication enabled, use the following steps to create an iCloud Security Code.
Step 1: Go to Settings > iCloud > Keychain and turn on iCloud Keychain.
Step 2: Tap on Advanced. Then turn on Approve with Security Code.
You can Use iPhone Passcode as iCloud Security Code or select to Create Different Code. But it's recommended to use your phone's existing passcode which makes it easy to remember.
Step 3: Enter passcode, then enter a phone number where you can receive SMS messages.
That's all. If you forgot iCloud security code, you can reset or change a new iCloud Security Code.
Use these steps below, you can easily setup iCloud Keychain on Mac.
Step 1: On Mac, open System Preferences.
Step 2: Click on iCloud.
Step 3: Select Keychain. If you want to, you can set a passcode to unlock your screen after sleep.
Step 4: Enter your Apple ID password to set up iCloud Keychain.
If you want to access saved Passwords and credit card numbers with iCloud Keychain, see in view Safari's Password.
Reference: What is iCloud Keychain.