United States 2021 estimated population was 332 million, while combined active duty, reserve, national guard, and (most of the) civilian employees of the five uniform services (Army, Navy, Air Force, Marine Corps, Space Force - missing civilian numbers for last two) amount to around 2,870,000, or around 0.86% of the population. US federal budget for 2021 fiscal year included $705.4B for Department of Defense, compared to $22.99T in US GDP, or about 3.07%.
Also, the ~3% of US GDP doesn't keep just the soldiers, sailors, etc., of the US military employed, it also employs defense contractors, local businesses outside of military bases, etc., and does some of that around the globe, not just in the US.