Etymology of Underscore
Why is the character _ called underscore?
Well, because, we are doing a score, under it. What's a score? It is to mark a notch to count, tally.
etymology of underscore
1771, “to draw a line under,” from under + score (v.). The figurative sense of “to emphasize” is attested from 1891. Noun meaning “a line drawn below (something)” is recorded from 1901.
[etymology of underscore https://www.etymonline.com/word/underscore]
etymology of score
late Old English scoru “twenty,” from Old Norse skor “mark, notch, incision; a rift in rock,” also, in Icelandic, “twenty,” from Proto-Germanic *skur-, from PIE root *sker- (1) “to cut.”
The connecting notion probably is counting large numbers (of sheep, etc.) with a notch in a stick for each 20. That way of counting, called vigesimalism, also exists in French: In Old French, “twenty” (vint) or a multiple of it could be used as a base, as in vint et doze (“32”), dous vinz et diz (“50”). Vigesimalism was or is a feature of Welsh, Irish, Gaelic and Breton (as well as non-IE Basque), and it is speculated that the English and the French picked it up from the Celts. Compare tally (n.).
The prehistoric sense of the Germanic word, then, likely was “straight mark like a scratch, line drawn by a sharp instrument,” but in English this is attested only from c. 1400, along with the sense “mark made (on a chalkboard, etc.) to keep count of a customer's drinks in a tavern.” This sense was extended by 1670s to “mark made for purpose of recording a point in a game or match,” and thus “aggregate of points made by contestants in certain games and matches” (1742, originally in whist).
[etymology of score https://www.etymonline.com/word/score]