First, please note that people do not call World War I “the war to end all wars” anymore unless they are being ironic. The idea that WWI would end all war was a hope that was cherished by some people at the time. However, it very quickly became clear that this was a misguided hope.
The phrase “war to end all wars” was first used by the British author H. G. Wells. He, and others, felt that this war would put an end, once and for all, to the sort of governments and attitudes that brought war about. He felt that German militarism was to blame for the war. He felt that, by defeating Germany, the Allies could make it clear that militarism was pointless and could ensure that perpetual peace would ensue.
President Woodrow Wilson did not use the phrase much, but he saw the war in this way as well. He felt that the settlement after the war could create a new world order that would remove the causes of war. This was why he issued his “14 Points.” He thought that the creation of better international laws, along with a League of Nations, could prevent future wars.
Thus, WWI was called the “war to end all wars” because there were people who felt that it would lead to the destruction of the sorts of governments and attitudes that caused war.