I can't say about chrome as not using it , if you are signed in with safari browser .
Some scenarios are created ( a ) if Mac and iPhone are connected with usb cable on the same network having same Apple ID and password say Apple ID is example1@icloud.com and you sign in at www.icoud.com the Apple ID is set up with 2FA and the trusted number is verified .
see these screen shots .
The same map window will appear on iPhone , if you go to iPhone and click on allow the verification code appears over iPhone , come to Mac enter the code , the account is accessed .
( b ) if the Mac is not signed in with same Apple ID and password with iPhone , enter the credentials , sometimes it prompts to enter admin password , enter it access the account .
If you click on cancel , enter manually the Apple ID the password is automatically filled up , as iCloud Keychain is set up in Mac , if code is not displayed , click on resend code , the account is accessed .
( c ) , if you don't want to use these methods , from Mac itself open system preferences > click on Apple ID icon > in password and security section click on get a verification code , with the help of code access iCloud.com , entering the credentials .
In you case if you click on trust this device the next time you won't be prompted to enter code using latest versions of iPhone ( the device is accepted and trusted ) the server assumes for sure that right credentials are signed in by the right account holder .