See If you forgot the passcode for your iPhone, iPad, or iPod touch, or your device is disabled https://support.apple.com/en-us/HT204306
Also, if you are in activation lock, see:
Turn off Activation Lock https://support.apple.com/en-us/HT201441 “If you erase your device without signing out of iCloud first, it might still be protected by Activation Lock. Whether you erased your own device or bought one from someone else, you can turn off Activation Lock by entering the correct Apple ID and password.”
If you can't activate your iPhone https://support.apple.com/en-us/HT201407 "If your iPhone can't be activated or an alert says the activation server is unavailable or the SIM card is unsupported, learn what to do.”
Ultimately you are likely to have to Use recovery mode to restore your iPhone.