See: RFC 3092: Etymology of “Foo”, D. Eastlake 3rd et al.
Quoting only the relevant definitions from that RFC for brevity:
- Used very generally as a sample name for absolutely anything, esp.
programs and files (esp. scratch files).
- First on the standard list of metasyntactic variables used in
syntax examples (bar, baz, qux, quux, corge, grault, garply,
waldo, fred, plugh, xyzzy, thud). [JARGON]