World War I led to an economic and industrial boom, as factory owners known as "Merchants of Death" made billions off of supplying the Allies war effort. It created a vibrant middle class in this country that would strengthen all the way through the 1920s.
World War II, on the other hand, benefited us first by taking us out of the Great Depression once and for all. The massive numbers of jobs it created, both in and out of the military, jumpstarted our economy. Again, we supplied the allies with war material as well as outfitted our own massive armies.
The aircraft giant Boeing was put on the map making bombers for World War II, and scores of other companies and factories were created with military contracts that turned commercial when the war was over, and brought us millions of jobs for the rest of the century.
Both of these wars helped the US economically in much the same way.
First, during the war, the US was the "Arsenal of Democracy." That is to say that the US was the source of many of the weapons used by the Allies. These were generally bought by, rather than given to, the Allies, especially before the US joined the wars.
After the wars, the US benefited as well. Both times, the economies of European countries were devastated by the war (especially after WWII). In both cases, but especially after WWII, the US was able to outcompete the other countries because the US was essentially untouched by the wars. This meant US companies had huge advantages over companies in other countries.
There are tremendous similarities between WWI and WWII, and there is no doubt that war was good for the economy in both cases. Prior to America's direct military involvement in both wars, Wilson and Roosevelt had both proclaimed neutrality while Europe and later Asia were already in the throes of international conflict. The US was profiting in the billions by trade with the Allied countries of Europe, most notably Great Britain. It is no secret that the US was profiting through increased military production, supplying the war effort, and by loaning money to warring countries. Once the US became directly involved in the war effort, military production continued/increased, and many new jobs were created and occupied by groups of people that had not previously been employed (e.g., women). Lastly, when the wars were finally over, the US had the responsibility to fund the reconstruction efforts in many European countries thus continuing strong economic development
I agree with the last answer. I'll also add that both World Wars brought on a post-war renassiance of industrial productivity due to the fact that (a) many parts of the US had to be rebuilt, and (b) US knowledge of technology and industrial design was increased by its involvement in both wars.