As I understand GDP, it's the sum total of all money spent in a given country over a year/quarter.

But the US government, as far as I know, does not go around asking people how much they spent.

Yet they can still estimate the US GDP. How?

(hazarding a guess: They use data from tax filings. They know how much everyone in the country received, and it's safe to assume that money was given by someone else.

Suppose there's a country of 3 people. In a given year, Alice made $60 from domestic transactions, Bob $20 and Carol $10. Logically, this means $90 were given in total to each person, so the nominal GDP is $90.

As a proof: If inflation did not occur in that year, the only way one person can get money is if others spend theirs. Bob and Carol gave Alice $60 in total. Alice and Carol gave Bob $20 total. Alice and Bob gave carol $10.

If inflation did occur, the central bank spent money, and the result is the same.)