Initially, King David ruled from Hebron, but Hebron was not the ideal location for the seat of government. Not only was Hebron in the southern-most part of the Israelite kingdom, but it was deep in the heart of the territory of Judah. When trying to create a united kingdom, ruling from within one’s own tribal stronghold is not particularly astute. The ideal capital for a united kingdom would be a central city that was not yet claimed by any of the tribes (There were still several remaining foreign enclaves within the kingdom).
On the northern border of Judah there existed just such a city. Jerusalem (as we now call it) was a Jebusite city situated on the border of Judah and Benjamin (the tribe from which King Saul had come). So “the king and his men went to Jerusalem [and battled] against the Jebusites, the inhabitants of the land...Nevertheless David took the stronghold of Zion; the same is the City of David” (II Samuel 5:6-7).
The geographical spot on which Jebusites had built their city had already achieved acclaim in the days of Abraham. According to the sages, this was the place from where Malchizedek, King of Shalem, “brought forth [to Abraham] bread and wine; and he was the priest of God the Most High” (Genesis 14:18). The word “shalem” can be translated as both peace and as wholeness.
This same location is later called Mount Moriah, and was the site of the binding of Isaac. At that time, “Abraham called the name of that place Hashem-Yirah; as it is said to this day: ‘On the mount where God is seen’” (Genesis 22:14).
This city therefore came to be called a combination of these two names, Yirah (He will see) and Shalem (peace/wholeness), or Yerushalayim (Jerusalem). (Source Midrash Genesis Rabbah 56.)