How did Spanish influenza result from WWI?
First, please note that I have changed your question to refer to World War I rather than to World War II. The Spanish influenza pandemic happened in 1918 and 1919. Therefore, it clearly did not result from World War II. On this basis, I have changed your question.
Second, we cannot say that the disease itself was a result of WWI. The disease occurred naturally, but WWI was important in spreading it. WWI allowed the disease to become a worldwide pandemic.
This disease appears to have arisen in the Midwestern United States in the spring of 1918. At that time, the US was sending military personnel to Europe to participate in the last days of WWI. Inevitably, some of the military people had the flu. They brought the disease to Europe. From Europe, the disease spread. For example, English soldiers who had been exposed to the disease in Europe spread it to Sierra Leone in Africa.
World War I was a huge war that brought together people from many parts of the world. By doing so, it allowed people from different areas to all be infected with the Spanish influenza. This allowed the disease to spread and become a worldwide pandemic.