I used to be able to do a SIM swap online without calling customer care. It seems that's no longer possible*. You just need to get a replacement SIM and call customer service at 1(800)937-8997. You could go to a T-Mobile store and get this done. You can order a SIM-only online.
*This is unfortunate because I carry a spare SIM when traveling and if my phone was lost or stolen, I could do the SIM swap online by myself. Now, I have to be sure to have the setup to make a voice call, which can be expensive if abroad.
Manage your T-Mobile account