Your phone is still locked to Sprint. Even if they were unlocked the iPhone 5 would not be a good phone to use with T-mobile since it lacks support for bands 2,4,12,66, & 71. That's pretty much the whole LTE network. Your S6 is slightly better off but not by much. I would suggest buying a phone no later than the 6s when it comes to Apple and as far as Android devices from Samsung no later than the S7. Although in the Android space there are better options if your heart is not deadset with sticking with Samsung.
I had the same problem. Sprint insisted that my S6 was unlocked. It took nearly six months of repeated calls to Sprint until I found someone that hit the right switch. Here is my original thread...Invalid Sim