Why did David go to Eretz Pelishtim?
Malbim: After Hashem told him that he will not build the Beis ha'Mikdash since his enemies were not yet cut off, he saw that Hashem did not want to him to rest from war. He went to his enemies to make war in their lands. Until now, the Pelishtim came to his land, and he did not subdue them. Now he went to their land and subdued them, and took part of their land, i.e. Meseg ha'Amah.
Here it says "Meseg ha'Amah." In Divrei ha'Yamim I, 18:1, it says "Gas u'Vnoseha"!
Rashi: It is called Meseg ha'Amah because it is the staff that rules over all the Pelishtim, the capitol city of kings. We do not find the Sarnei Pelishtim in Ashdod, Azah, Ashkelon or Ekron called 'king', only in Gas - "Achish Melech Gas" (1:21:13). Meseg is the spike of the pole of the plowshare.
Targum Yonasan: Tikun Amsa. Radak - perhaps a stream passed through the city; they fixed it to come from another city to this city. Therefore the city was called Meseg ha'Amah.
Radak: Gas and its suburbs were called Meseg ha'Amah.
Radak citing Pirkei d'R. Eliezer 36: When Avimelech came to Yitzchak to make a Bris, he said 'I know that Hashem will give to you and your seed all of these lands. Make a Bris that you and your seed will not take Eretz Pelishtim. Yitzchak cut one Amah of the bridle of the donkey he was riding on, and gave it to them as a sign of the Bris Shevu'ah. When David became king, he wanted to go to [conquer] Eretz Pelishtim; he could not, due to this Os Bris, until he took the Os Bris. After, he took Eretz Pelishtim.