( a ) Open system preferences > click on iCloud and click on sign out , you can see a window stating do you want to keep a copy of your iCloud data on this Mac before signing out ? The boxes iCloud Drive , contacts , calendars , reminders are checked by default - so click on keep a copy .Immediately click on stop updating and continue , a pop up window will appear are you sure you want to stop updating and continue with sign out ( any documents not updated to iCloud Drive , will be moved to a folder named “ iCloud Drive archive in your home folder on this Mac ) so don’t click on “ cancel “ but " click on continue with sign out ."
A pop up window will appear . Do you want to keep a copy of safari passwords on this Mac ?
( 1 ) Delete from Mac ( 2 ) cancel ( 3 ) keep on Mac .
in the initial stage you had set up iCloud Keychain in Mac and iPhone see these https://support.apple.com/en-in/HT204085
https://support.apple.com/en-in/guide/iphone/iph82d6721b2/ios
What happens when I turn off iCloud Keychain on a device?
When you turn off iCloud Keychain for a device, you're asked to keep or delete the passwords and credit card information that you saved. If you choose to keep the information, it isn't deleted or updated when you make changes on other devices. If you don't choose to keep the information on at least one device, your Keychain data will be deleted from your device and the iCloud servers.
So it depends , if you had not clicked on keep a copy of copy to save passwords then they had deleted from the device and iCloud server .