Fixing your T Mobile chip is thankfully really easy when you forget your PIN code. All you need to do is find out your PUK code by contacting T Mobile's customer services. They'll be able to provide them with the PUK code, which will instantly unlock your sim card and allow you to set up a new PIN.
In the UK, you can do this by heading over to the T Mobile / EE website and following the instructions. They'll ask you to sign in to your account online and go to the Unblock SIM area of the site, which will then let you know what your PUK code is.
If you hadn't previously set up an account online, that's no problem either. You can just give them a ring, either on 150 if you're calling from another T Mobile phone, or on 0845 412 5000 if you're calling from another network or landline.
They'll then ask you a series of security questions, so try to have a few telephone numbers handy that you're likely to have recently called or texted.
If you're using T Mobile in the US, then getting hold of your PUK code is even easier! It's listed directly on the back of the sim card's jacket:
If you've lost the jacket that your chip came in, then again you can just give them a ring, either on 611 if you've got another T Mobile phone handy, or else on 1-877-453-1304.