First, try performing a hard reset on your iPhone by pressing and holding the Home button and the Sleep/Wake button simultaneously until you see the Apple logo appear on the screen. This may help to reset the device without requiring an activation code.
If that doesn't work, you can try putting your iPhone into recovery mode and restoring it using iTunes on a computer. Connect your iPhone to your computer using a USB cable, then open iTunes. Follow the steps to put your iPhone into recovery mode, which typically involves holding down the Home and Sleep/Wake buttons until the recovery mode screen appears on your iPhone.
Once your iPhone is in recovery mode, iTunes should detect it and prompt you to restore it. Follow the on-screen instructions in iTunes to restore your iPhone to its factory settings. Keep in mind that this will erase all data on your iPhone, so make sure you have a backup if there's any important data you need to save.
If you're still unable to factory reset your iPhone without an activation code, you may need to contact Official Apple Support for further assistance. They may be able to provide additional options or guidance based on your specific situation.