If your iphone is free from any network lock means,you will be able to use your T-Mobile sim.Locked means,you will need to unlock your iphone.For unlocking visit SuperUnlockCodes.com
They will provide an unlocking service for particular networks only.Not provide an unlocking service for AT&T