Relations between Jews and Gentiles have been problematic for most of the history of the Jewish people. Abraham seems to have been humble about his special relationship with God, and Isaac and Jacob as well. They all seem to have integrated well into the world around them, while staying faithful to YHWH. The Patriarchs, while flawed, knew the Lord, and were honored for it.
Slavery in Egypt was a defining period in the Jewish nation, and they understandably hated the Gentile Egyptians. The Passover highlighted the distinctiveness of the Hebrews as God’s people, and on Mt. Sinai the tribes received the Law which separated them in many ways from those around. Psychologically, such distinctiveness sometimes leads to short term feelings of inferiority and long term feelings of superiority.