If you look at this NFL Teams map:
You'll see that the mojority of the teams are on the Eastern side of the map, and not a whole lot of NFC on the West. Therefore, Kansas City Chiefs had to be AFC West, because it was the closest team to the West. Same with the St. Louis Rams. Closest to the West. Although I don't know why the Cowboys are NFC East, when they are closer to South then the Panthers are, and the Panthers are NFC South.
This is just what I think. I don't know how the NFL picks what division a team goes to.