According to Michael Brecher (Decision in Crisis: Israel in 1967 and 1973 and , yes, I know it’s the most generic title possible) there were three “tripwires” that drove Israel to war.
The first was the withdrawal of UN peacekeepers (UN Emergency Force I) from the borders between Egypt and Israel. This was carried out to comply with a request from the United Arab Republic, backed by the Soviet Union. UN General Secretary U Thant complied despite protests from France and the United Kingdom.
The second were “suspect” troop movements near the Sinai which, to be honest, were the result of either a colossal mistake or downright deception on part of the Soviet Union. Anwat Sadat had been briefed by the KGB in Moscow about Israel deploying ten to twelve brigade in preparation for an attack on Syria and hence Nasser ordered the Egyptian army to be deployed near the Suez Channel. Israeli intelligence became aware of this briefing while Sadat was still in Moscow, indicating they had infiltrated either the Soviet intelligence or the highest ranks of the Egyptian military.
The third were the frequent overflies by Egyptian or Soviet aircraft of the area near the nuclear research facilities at Dimona. Overflies intesified around May 1967, leading the Israeli leadership to believe (correctly as it turned out) Nasser wanted to strike the first blow, obtaining and consolidating territoral gains before Israel had a nuclear deterrent. Nasser believed Israel would not have nuclear weapons before 1968 and planned accordingly. According to LTC Warren Farr (The Third Temple’s Holy of Holies: Israel’s Nuclear Weapons, published by the USAF Counterproliferation Center) Israel assembled its first two nuclear weapons and went to war ten days later.
Also Israel’s legendary intelligence service had made a big mistake of its own: they believed (wrongly as it turned out) the Soviet Union had supplied Egypt with advanced nerve gas. Egypt had various chemical agents but nothing as advanced as the Israeli believed. Also their meager stocks had recently been depleted in Yemen and Moscow still wasn’t willing to supply her Arab allies with advanced weaponry.
What finally sent Israel over the edge was the closure of Straits of Tiran in May 1967. Israel’s Prime Minister, Levi Eshkol, had made clear to both Johnson and De gaulle Israel would not attack the UAR unless the Straits of Tiran were closed off. This was Israel’s main gateway to Asia and her main crude supplier, Iran (ironic, isn’t it?). According to international law this was an act of war.
Nasser had swallowed the Soviet bait, and took in hook, line and sinker when he went on one of his famous speeches proclaiming in front of hundreds of foreing reporters “We will not accept any coexistence with Israel”.
This phrase, together with the aforementioned closure of the Straits of Tiran had put Israel in a very favorable light with the West: the defiant little State surrounded by hordes of barbarians armed to the teeth by the Soviets. International law was on Israel’s side too, as an ultimatum had been formally issued before the first shots were fired.
It must also be said the occupation of the Jordanian West Banks was not premeditated. In fact Israel negotiated with King Husain to the last minute to keep Jordan out of the war and Moshe Dayan instructed the IDF not to fight the Jordanians. This changed when the Arab monarch (probably trying to prove to the Egyptian revolutionaries and their Soviet allies his support for the Arab cause) ordered his artillery to shell civilian targets in both West Jerusalem and Tel Aviv. In two days Jerusalem was completely conquered by the Israeli and the Jordanian military humiliated.