I’m not quite familiar with US cellphones, but I can tell you how it works in Denmark with GSM.
The plan you are operating on would be descided by the GSM simcard that is currently in the phone.
Phones can be either locked to a specific cell network, a specific provider or unlocked.
If it is unlocked, you can use whatever simcard in the phone that you happen to have.
If it is locked to a network, you can use it with all simcard that operate on that network, it’s quite common here that there are a few big network and other companies (MVNOs) rent themself into that network, their simcards would work with the network locked phone too.
For a provider locked phone, only that providers simcards will work.
The phone itself does not know what plan you have comitted to.
As I said, that is how it works here with GSM, things might be different elsewhere.