Two questions here.
1. What size trained and equipped force could have successfully defended against the historical Japanese invasion.
2. What size trained and equipped force could have successfully defended against the maximum plausible Japanese invasion with further reinforcements.
You can defend against the historical Japanese invasion with 20,000 rifles and 200 WW1 era artillery pieces if you get some better leadership and don't let the Japanese catch your airforce on the ground.
Japan can reinforce much easier than America can and can bring an additional division or two and some air support in and the American defense would be overwhelmed.
I think there were agreements in the Washington treaty about signatories not building fortifications in the Pacific. Anyway given the place was expected to fall, why build almost indestructible (by anything the USAAF had until the end of the war) sub pens for the Japanese.
Yes their were treaty conditions forbidding fortification of various points in the Pacific (though much like almost every other part of the interwar military restriction treaties the Japanese cheated or just outright ignored the shit of whatever they were supposed to be. Like building "treaty cruisers" that were like 4K tons heavier then the treaty specified). But assuming the US had been willing to fortify earlier and been willing to spend real money they probably could have made Guam and parts of the Phillipines effectively untakeable. As in built up, so well armed, so well supplied, and the like that they could have held out for 2 or 3 years under siege until the rest of the USN fought it's way across the Pacific.
I'm thinking about a maximum fortified Guam. Something like a full USMC Base Defense Brigade (with integrated AA, field artillery, coastal artillery, AA, combat engineering, infantry, armor, and combat aircraft elements all in one coordinated bundle), 2 high quality regular US Army Brigades, a Brigade of high quality NG, a battalion or regiments worth of high quality Chammoro Militia, and a number of independent regiments, battalions, and so on artillery (field, Coastal artillery, AAA, chemical mortar, and the like) combat engineering, Sea Bees, logistical, and signal units as well as say 2 Companies of Sherman Medium Tanks, 1 company of older M3 Lee Medium Tanks, 3 companies of light M3 Tanks as well as two companies worth of an American SU76 equivalent (basically something sort of the US tank destroyer but instead of being for attacking enemy tanks it's equipped with a 75mm/76mm Howitzer with a high elevation. It's fast but has very light armor. Another 40 or so 37mm gun armored cars and a sizable number of trucks, motorcycles, half tracks, and fully tracked license produced Bren Gun carriers for transporting men, weapons and supplies between the various fortifications on Guam with many of them either being armed or being easily armed. This includes a number of half tracks mounting a 75mm gun for direct fire support. For coastal artillery the high end is a mix of about two dozen 8 inch/7 inch guns and and half a dozen modernized 12 inch sea coast defense mortars and a total of 6 12 Inch guns in three modernized two gun turrets salvaged off scrapped dreadnoughts capable of higher elevation and with extra armor and protection being appleid as the "heavies". A sizable number of about 100 medium to lightish Field and Coastal artillery weapons (ranging from about 155mm guns to 75mm or so of both guns and howitzers. Some are Field artillery pieces others are purpose designed coastal artillery weapons and others are older weapons salvaged from scrapped warships). A sizable number of lighter weapons (many DP AA guns like M2 Brownings, 20mm Oerlikons, 40mm Bofors, older "Pom Poms") as well as 37mm AT guns, modernized WW1 era 37mm "Trench Guns", and various light 37mm-57mm "Hotchkiss anti torpedo Boat guns" taken from scrapped warships. A sizable number of AA both US Army and USMC ranging from a handful of new 90mm AA DP guns to modernized 75mm AA guns to medium to light designs of 40mm Bofors, 20mm Oerlikons, .50 BMG M2 Brownings and .30 Caliber M1919 and M1917 guns in various types of mountings including a number mounted on Bren Gun Carriers or Half Tracks to act as SPAAGs. Guam has two of the new Radar sets and a complete set in storage for replacement. Aircraft wise Guam has roughly 250 modern 1st line single engine fighters (P40s and P39s for the Army Air Corp and F4 Wildcats for the Marines) and about 50 active second line fighters (P36s) as well as 75 crated P39s or P40s and about thirty or so P36s in storage. Guam also has about 40 "Heavy fighters" namely P38's with another 15 either in for repair or crated for use as spares. For attack Guam has 50 A20 Havoc, 15 B17s (mostly used for recon), about 75 USMC/US Army Air Corps manned SBD Dive Bombers (and another 30 either in the shop or still crated). Their are about half a dozen DC3s/C47s and about 15 or so light to medium transports of various osrts and about 20 trainers, target tugs, and the like. The USN has about 40 PBY Catalina's for recon and maritime strike. The airfields have fortified shelters for most of the aircraft and high value material. Fortifications are extensive across the island including a concrete pen capable of holding 8 Fleet Boat Submarines (though in this case 6 Fleet boats and 4 shorter ranged Coastal submarines are stationed) with functioning torpedo. Their are also about 25 Torpedo Boats, a number of mine layers, a handful of armed yachts and trawlers for picket duty and several Tenders to support the various forces.
The USMC and US Army troops are very well armed with ORBATs more similar to late WW2 with much higher concentrations of M1919A6s, M1 Carbines, BARs, Thompson and M3 SMGs, bazookas, rifle grenade launchers, and the like with all of the Marine and the US Army infantry (including the NG) having semi auto M1 Garands with only second line troops and the Chamorro's still having M1903s or M1917s (though for the no Chammoros many of the rear end and logistical troops have M1 Carbines, M3 SMGs, or Trench Shotguns) along with higher concentrations of light and medium Mortars, Bazookas, M1919s/M1917s, M2 Brownings, light artillery in the weapons companies.
The Island is surrounded with a extensive network of naval mines of various types.
There are enough supplies stocked deep in fortified warehouses that when supplemented with some gardening and fishing they'll be able to hold out for at least two years cut off.
So basically a bunch of aircraft, some subs, a really really heavily armed Division equivalent, artillery up the wazoo including guns taken from early Dreadnoughts, and shit tons of reinforced bunkers and shelters of various type with the island being practicaly covered in Concrete, air strips, or mine fields. The Japanese would need to reorient their entire strategy around trying to seize Guam and they'd probably need to try and land multiple divisions with extensive air coverage and multiple battleships to try and reduce the fortifications (and prevent those 6 inch to 12 inch guns and mortars from tearing apart anything lighter then a heavy cruiser that get's within useful range of Guam.) Each possible landing site is covered in pre sited artillery and mortars with bunkers and pillboxes packed to the brim with light artillery and machine guns that can be reinforced by tanks that can take a direct hit from the most powerful tank in the IJA arenal at point blank range and ignore it.