Up until 1967, the bad guys were Britain.
Britain seized Palestine from the Ottomans during WWI with the help of the local Palestinians, promising the Palestinians sovereignty in exchange for their help overthrowing the Ottomans.
At the same time, Britain promised to create a homeland for Jews in Palestine (in the Balfour Declaration), and Jewish refugees from Europe began settling in Palestine. Britain did this because they thought they might gain the support of Jewish financiers for their war efforts.
The Balfour Declaration was deliberately vague about whether Britain was giving all of the land to the Jews or just some of the land. It was vague because Britain wanted to appeal to Jewish Zionists (who wanted all of Palestine) while not alienating the Palestinians.
Britain never did divide the land, resulting in two different populations who felt they legally owned the land, one who had always been there, and one who mostly arrived as refugees.
When Britain left following WWII, a civil war broke out for control of the land. A border was eventually drawn at the line of control (which ran through the middle of Jerusalem), and Israelis declared the new State of Israel, while Palestinian refugees fled to their side of the border or neighbouring states. That was in 1948.
So, up until then, it's a messy situation created by Britain, but one which eventually resulted in the land being split (albeit violently), with both Israelis and Palestinians having a state, and each having part of Jerusalem. The world accepted this as the new status quo and hoped it would be sustained peacefully.
That changed in 1967 when Israel annexed the Palestinian lands (the West Bank and the Gaza Strip) in the Six Days War. Since then, Palestinians have been living under a harsh Israeli occcupation as a stateless people (meaning no citizenship), with their rights and freedoms strictly curtailed. Palestinians have been resisting through a number of resistance movements, usually designated as terrorist groups in the Western media.
There was a political movement towards peace and repartitioning of the land that peaked in the 1990s, but since then it has been held up by a series of right-wing governments in Israel. Meanwhile, Israel has been aggressively building Jewish neighbourhoods (called settlements) in the formerly Palestinian lands of the West Bank.
So since 1967, Israel has pretty clearly been the bad guy.
The terrorist attack that killed 1200 young Israelis was horrific, and we should all hope nothing like that ever happens again. But the root cause of the attack was Israel's occupation of Gaza and the West Bank. The way to prevent future terror attacks is to end the oppression of the Palestinian people.