Unfortunately, if you forgot your passcode, you will need to wipe the phone which will erase all data.
If you made backups, you can restore your data from them. If you haven't backed up already, then no, it will not save automatically.
If you forgot the passcode on your iPhone, or your iPhone is disabled or unavailable -
Click on the link for instructions on how to reset your passcode without a computer if you have iOS 15.2 or higher.
How to remove your iPhone, iPad, or iPod touch passcode without a computer - Apple Support If you see an iPhone or iPad unavailable message or Security Lockout screen - Apple Support
Click on the link for instructions on how to reset your passcode using a computer.
If you forgot your iPhone passcode - Apple Support If you forgot your iPhone passcode - Apple Support