A SIM card (Subscriber Identity Module) is an integrated circuit mounted in a removable card which is used in nearly all mobile phones to store information about the network and user account which is activated on the phone, as well as some limited capability of storing user data such as contact numbers (though modern phones have their own superior ways of keeping this sort of thing, so the SIM contact storage isn't used as much these days). Much of the SIM information is intended as "write-once, read-many", implanted into the card once by the carrier and unchangeable thereafter, while some other things (such as the contacts) are user-modifiable and may be inserted, changed, and deleted.
If a phone supports it, you can move your account to a different phone, and switch between different accounts on the same phone (for instance, when traveling to a different country to use a local account that avoids roaming fees), by swapping SIM cards. However, carriers make this difficult by typically locking phones so that they will not work with swapped cards. You may have to pay a lot more for an unlocked phone.