The SIM does two main things:
1: It provides information so your phone can identify itself to the cellular network. It does this with a unique ID.
2: It instructs your phone which networks it is and is not allowed to connect to, and in what order (i.e. connect to the main provider whenever it's available, and only connect to a roaming partner if it's not). The only time the phone will attempt to override this is in the case of an emergency call.
Optionally the user can store contact data on the SIM, but I don't know why anyone would choose to do so in this day and age. This functionality is a throwback to the dumb phone days. Every phone I ever had, going all the way back to the T-68i, always buried this so deep in the menu structure that most users never knew about it, even in the days that it would have been useful