I forgot my Screen Time passcode
If you used your Apple ID when setting it as requested then you can do this
If you forgot your Screen Time passcode - Apple Support
If you failed to do that or chose not to then you must wipe the phone in recovery mode and start again with a blank phone.
You can export as much data as you can to iCloud, turn on iCloud Photos etc before wiping it so you can get it back, but you cannot restore a backup as that will be locked too.
Recovery mode or DFU
If you can't update or restore your iPhone or iPod touch – Apple Support (UK)