In most cases an Apple iPhone will automatically configure itself to access data on T-Mobile's network when you first switch on your phone in the USA with a T-Mobile SIM in your phone.
If this does not work, you can download the settings to your phone by visiting unlockit.co.nz on your phone's Safari browser from a Wi-Fi connection then follow the prompts, selecting USA and T-Mobile. This will download the correct internet settings and automatically configure your phone.
Please note that you must be on T-Mobile's network in order to access data services. Internet access is not available when roaming on partner networks.