Someone tried entering various passwords in my phone so that he could unlock it. Since he didn't know my password my phone locked itself. I still remember the password I had set in my phone but I've failed to unlock my phone (Lumia 520).
You need a PUK (PIN unlock) key which you got from your mobile operator. If the PUK is entered too many times the SIM card will be permanently locked, and you will need to get a new one from your operator.