They were far away from other countries, dealing with the great depression, not exactly a superpower at the time compared to the European powers, with no real threat of war. It's not like other countries such as Argentina, or Turkey, or Sweden built up such military force around this time. So why did the US have the capability and drive to build up such a massive military power conveniently timed to play such a pivotal role in WWII? Google has failed me thus far in answering this question so I was hoping some real people could help.
Keep in mind there's way more to it than this, this is just an overview as far as my knowledge goes.
The Naval Treaties of the 1920s and 1930s.
Things began with the Washington Naval Treaty of 1922. Under the WNT, the US Navy was allotted up to 525,000 tons of capital ships (battleships and battlecruisers) and 135,000 tons of aircraft carriers, and an unlimited tonnage of cruisers, destroyers, etc.; with cruisers being defined as ships displacing no more than 10,000 tons and with guns no larger than 8" (further refinement of ship types would continue with the London Naval Treaties). This was equal to the allottment given to Britain, the US's main competitor in the Atlantic, and greater than the one given to Japan, the US's main competitor in the Pacific (315,000 tons of capital ships and 81,000 tons of aircraft carriers).
In the London Naval Treaty of 1930 further limitations were set on cruisers, destroyers, and submarines. Britain was allowed to build up to 15 heavy cruisers with a total displacement of no more than 147,000 tons; the US were allowed 18 with a total displacement of no more than 180,000 tons, and Japan was allowed 12 with a total displacement of no more than 108,000 tons. There was no ship limit set on light cruisers, but Britain was limited to 192,000 tons, the US to 143,500 tons, and Japan to 100,450 tons. For destroyers, Britain and the US were allowed 150,000 tons and Japan 105,500 tons.
This encouraged the expansion of the US Navy to make the most of the allowance it was given and to not be overtaken by Britain and Japan, especially Japan which was undertaking a rather ambitious expansion of its navy; which leads nicely into my second point.
Japan
The Washington Naval Treaty was controversial within the Japanese Navy. One one hand it considered Japan to be a second-rate naval power to the US and Britain, meaning Japan would never have a quantitative advantage against its two main rivals. On the other, however, American and British ship production capacity was significantly higher than Japan's, and the treaty prevented an unlimited naval arms race which Japan would never be able to win. As such, Japan focused on obtaining a qualitative superiority over its rivals rather than an unobtainable quantitative one. This could be seen in several areas.
In 1928, Japan introduced what is considered to be the first modern destroyer in history, the Fubuki-class. These were large, fast, and heavily-armed destroyers that outclassed any other destroyer on the planet at the time, and were in some ways comparable to other nations' light cruisers. In the later years of WWI and the early 1920s, the US Navy had constructed a total of 267 Wickes- and Clemson-class destroyers, and the Fubuki-class had just rendered them all obsolete. Much to Congress's displeasure, new fleet of destroyers would have to be constructed in order to keep up with the advances in technology and design brought on by the Fubukis, beginning with the Farragut- and Porter-classes. The US would design and build numerous classes of destroyers prewar, and enter into WWII with (among others) the combined Benson- and Gleaves-classes, which would grow to a total of 96 ships, and the incoming Fletcher-class, which would ultimately have 175; absolutely dwarfing the number of destroyers Japan was able to build both pre-WWII and during the war.
The Naval Armaments Supplement Programme, more commonly known as the Circle Plans, were four expansions of the Imperial Japanese Navy that occurred throughout the 1930s. I'll only be naming the important ships, but numerous classes of destroyers, submarines, etc. were also included, and each plan included dozens of ships total. Circle One in 1931 was centered around the Mogami-class cruisers, a class of light cruisers which, like the Fubuki-class destroyers, brought radical advancements in design which gave them basically unprecedented capabilities among light cruisers. This directly led to the US designing the excellent Brooklyn-class to counter them, from which came all subsequent US cruiser designs. Circle Two in 1934 brought the carriers Sōryū and Hiryū and the Tone-class heavy cruisers. Circle Three in 1937 brought the Yamato-class battleships, the largest battleships ever constructed, and the Shōkaku-class carriers, arguably the best in the world at the time. Circle Four was the least radical, and was primarily smaller ships such as destroyers.
Japanese carrier aviation was also the best and most experienced in the time. I won't go into this too much because the first time they really saw combat was with the Second Sino-Japanese war in 1937, but suffice to say the Japan was at the forefront of carrier aviation by the 1930s.
On the political side, the Empire of Japan was becoming increasingly, well, imperialist, and in order to obtain the natural resources required for things like a massive naval expansion, it would need to acquire them from places outside the Japanese Islands. Actions such as Japan's invasion of Manchuria in 1931 and Japan's withdrawl from the aforementioned naval treaties continued to strain relations with the US and a conflict with Japan seemed more and more like an inevitability, thus the concern of ensuring American naval superiority over Japan.
The US
As you said, the US was in the middle of the Great Depression. In the years following WWI, many shipyards had closed their doors or moved on to other, more profitable ventures to remain solvent, and skilled workers had begun to leave the shipbuilding industry at precipitous rates, leaving the remaining yards undermanned and underperforming. Under President Hoover, America was in the middle of a large naval disarmament going into the early 1930s and it was lagging behind these other naval powers like Japan and Britain in terms of not only the construction of new warships, but the amount of ships total. If you had told someone back then that in just over a decade's time the US would have the largest and most powerful navy in the world, they probably wouldn't have believed you.
Enter FDR and Carl Vinson. President Roosevelt was Assistant Sectetary of the Navy from 1913 to 1920, and was thus well-versed in naval affairs and had long been an advocate for the expansion of the fleet, and Vinson was a Representative from Georgia who became chairman of the House Naval Affairs Committee in 1931. Vinson had little success with his naval ambitions with the previous administrations, but found Roosevelt much more receptive.
In 1933 Roosevelt introduced the controversial National Industrial Recovery Act by executive order, which included $238 million to built 32 new warships as part of the Public Works Administration, including famed ships such as the first two Yorktown-class carriers. The Vinson-Trammell Naval Act in 1934 allowed for the construction of 102 new warships over the next 8 years, intended to bring the US up to full strength allowed by the WNT and give the US Navy a large, modern fleet. The Naval Act of 1938 mandated another 20% increase to the fleet in response to the future Axis nations' imperialist actions and refusal to abide by the naval treaties. And finally the Two-Ocean Navy Act of 1940, which authorized a 70% increase in the size of the US Navy. These acts and others like them helped to revive the American shipbuilding industry, setting the stage for the end of the Great Depression and for the US to become the shipbuilding and naval powerhouse it would become during wartime. If you've ever wondered why Vinson has a carrier named after him, this is why.
And of course, none of this would be possible without the abundance of natural resources the US had access to within its own borders, it's already-existing (albeit crippled by the depression) industrial base, and infrastructure, which other countries just did not have.