First at all, Israel has a deep historic connection to the western democratic alliance, led by the USA. The Americans helped Jewish people to establish their own country and future generations of Germans remain responsible for the security concerns of Israel.
On the other hand, China and Russia forcefully try to break apart the western democractic alliance and want to create a multipolar world of global and regional superpowers like Europe in the 19th century. Gaining the support of muslim-authoritarian states by showing sympathy for the Palestinensians is a powerful move to completely turn of countries like Turkey completeley away from Nato and EU. Imagine Turkey leaving Nato and becoming a full fledged member of the BRICS alliance.
The United States and the European Union (EU) support Israel because it is their main strategic partner in the Middle East.
Moreover, the US and the European Union (EU) have characterised Hamas as a terrorist organisation. This justifies their support to Israel. They have also formally expressed their support to the Trilateral Partnership of Greece, Cyprus and Israel which aims to construct the East-Med natural gas pipeline that will lead to energy diversification.
Russia doesn't support Hamas. It remained "neutral", as it neither condemned its attack on October, 7th nor supported it. It mearly asked for cease of fire.
In any case Russia and China are the main systemic rivals of the USA, soit is in their interest to support any action that goes against the US national interests.