macOS likes people to have an AppleID. Logging in with an AppleID when prompted gets many services/apps working together across Apple devices. This screen will often pop up with new hardware (simplifying setup) and new macOS upgrades. It's basically asking you to verify that you are you so that related apps like Messages, FaceTime, Mail, Photos, Keychain, etc can sync with iCloud and your use of such apps on other devices like iPhone or iPad. I'll guess since your last use of this Mac, macOS updated.
If you are not you- if this Mac was stolen and the thieves installed macOS- this blocks them from gaining access to your current communications in those other apps because they (probably) do NOT know your AppleID password.
From your description, I presume this screen popped NOT within a web browsing session, where it could be scam trying to get your AppleID but during or immediately after you booted up... before you might be running any third party software from any questionable sources. This sometimes pops up on first use of one of the iCloud apps like when one opens Messages, FaceTime, etc. If so, it is likely Apple asking you to link this computer/os update to iCloud and any other Apple hardware you have.
If you have a web browser open and this popped up like the old "your version of Adobe Flash is out of date" scams, close the browser, reboot and see if it pops while not using the browser. A good trigger is to open one of the iCloud-dependent apps made by Apple. If they need the link, they will pop this kind of prompt.