I'll guess it's probably Prolog, but maybe Planner (Prolog's predecessor) had it too.
The 1965 draft had _ https://dl.acm.org/doi/10.1145/363831.363839
The first standard edition with _ was 1968 https://www.rfc-editor.org/info/rfc20
The 1977 version is also available https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub1-2-197...
Underscores and dashes are not that different - especially as this is not just pre-computer but pre-typewriter.
And now, underscores are a logical choice when the dash is already in use as a minus sign.
1) https://literature.stackexchange.com/questions/1944/why-are-...
https://forums.welltrainedmind.com/topic/141704-jane-austens...
Replacing hyphen/minus with underscore has been done precisely for removing the ambiguity with the minus operator (In COBOL the ambiguity was less annoying, because the arithmetic operations were usually written with words, e.g. ADD, SUBTRACT, MULTIPLY and so on).