To hard reset your Nokia X2 you just have to press *#7370# and press Dial. The phone will request the security code that is by default 12345. Please be aware that you will loose all the data in your phone, so you should backup all relevant information.
If you want to soft reset your Nokia X2 you need to press *#7780# and then Dial. The security code is 12345. Once you complete this, your phone will come back to factory settings, but you will not loose personal data. Anyway it is recommended to make a backup before performing any of the mentioned procedures.
If you want to UNLOCK your Nokia X2 you may need a special cable or software. You can search here for additional information.