When Israel was created as independent nation, its neighbors in the Middle East reacted militarily. Why?
The basic answer to this has to do with religion and with the history of the region in which Israel was created. As the link below tells us, the Arab countries attacked Israel because they
felt that Israelis had stolen land from Arab Palestinians to create their country and that Israel was a threat to Arabic and Islamic cultures.
When Israel was created, land was taken from the Palestinians and given to a Jewish state that had not existed there in centuries. Not surprisingly, Arab states in the region were upset about this. For this reason, they attacked. In addition, the conflict had religious overtones. There was the issue, for example, of who would control Jerusalem which is one of the holiest cities in the Muslim faith as well as the holiest city in Judaism.
So, the military attack on Israel was meant to destroy the new nation because of the reasons outlined above.
The roots of this conflict go right through history. There is a religious element as the Jews believed it was a land to which they were destined to return. Also, it is religiously significant for Jews, Muslims and Christians. However it is wrong to overplay the religion card. Primarly the conflict was initiated over geopolitical considerations.
WW1 was key to creating the tension. In the Balfour Declaration the British, pressured by Weizmann, promised the Jews a homeland within the region known as Palestine (it should be noted that Palestine isn't, and never was, a recognised state- it is simply an area). In addition to this in the McMahon-Husseyn correspondence the British also promised the Arabs limited sovereign control of the area if they rebelled against their Ottoman rulers. Thus, both sides believed they had a rightful claim to the area.
When Israel was officially created the Arabs felt betrayed. From their perspective they had lived there continuously for hundreds of years, and they had been promised sovereignty. The Arabs nations who attacked did so out of geopolitcal considerations. Israel was viewed as an imperial force and the initial conflict was a result of this. Religion is a factor, but typical geopolitical considerations took precedence.
*This offers an unreferenced summary. Research into the declarations mentioned, the British Mandate and the UN mandate should provide a clearer explanation*