The whole of the Bible is a story of men who are given the commandments of God and then disobey them to their own detriment. Remember Adam and Eve were the first humans and were taught by God the commandments. Ultimately men like their son Cain choose to follow the devil instead of God and were no longer under the covenant or favor of God. Eventually it got so bad that God started over with Noah.
From Noah's family on we see again men with the commandments and covenants of God eventually choosing to disobey them. Which leads eventually to Israel and his sons. They are a line of the family of Noah that has kept the covenants and commandments of God. They eventually become the twelve tribes of Israel and the Bible follows the dealings of this people, seemingly the only people to have stuck with the commandments of God, as they struggle to survive and keep the commandments of God.
The reason for the above explanation is simply to show that while God created everyone and loves everyone there are people who chose, and still choose today, to disobey the commandments of God and they, in the case of Goliath the Philistines, as a people had at some point in their past rejected the commandments of God. So unlike David were not favored by the Lord. Remember when Saul was not following the commandments, and even later in David's life when he transgresses, he is not favored by the Lord either.
So we can see that God is just to everyone equally, but the Bible looks as you described it because it is written from the perspective of the line of people that for much of their history(though they struggled - remember they spent 40 years in the wilderness because of wickedness-) followed the commandments of God and were thus favored more by Him then other lines, or groups, of people.