Your standard 10 digit phone number consists of this: (xxx) xxx-xxxx
The first 3 digits (in the parenthesis) is your area code. As the name suggests, this is given to you based on your area.
For example, the 530 area code is used in a large chunk of Northern California.
As far as I know, the area codes are random.
Here is a map of all the area codes:
