The Subscriber Identity Module (SIM) is the security element of a GSM mobile phone. It is based on smart card technology and is now usually of the small form factor rather than the credit card size.

This card contains the identity of the subscriber IMSI, and the secret key used to verify this.

So by moving your SIM into a different phone you transfer your account to that phone.