I had it backwards for a long time. My mom always told me that X was hug and O was kiss, because the X is like the arms crossed around someone’s back, and the O is like the puckered lips.
That incorrect explanation has the unfortunate disadvantage of being much more understandable than the correct one.
Never seen O for a cuddle - or heard it called a ‘hug’ (which term I detest) until the last ten years or so. I have seen {} for that but only Internet. X goes way back. Probably the illiterate signing thing is more-or-less correct. It’s still in use. I had a form to fill in recently that I only glanced over and thought needed a counter-signature but on closer inspection was only if filled in for an illiterate. Could be too that X marked the spot for all kinds of things including ritual kissing the Bible and that sort of thing.
XO is relatively recent. (I am mildly surprised by a claim for the 1950s because I don’t recall seeing it before the 1970s, but that could simply be the lack of affection directed my way.)
X, XX, XXX, … goes back much further. You can find Xs for kisses (without Os) on letters in cartoons from the 1930s.
I would guess that O was partly chosen for hugs because the shape is very geometrically different from the X. They match up in that way. XOXO. Like Tic Tac Toe.
Here’s a 1973 commercial for the Bic Banana that shows a Mother writing a letter to her son. The x is a kiss and a larger circle represents a hug. So by that time the XOXOXOX convention was presumably common knowledge.
The greek letter Chi (X) is (in some dialects) pronounced /ks/ (cite). So the jump from kiss to /ks/ (written X) is not too far, for someone with a classical education.
Of course, I have no evidence, but it works for me.
I thought that the x started being used in the 18th or 19th centuries when lovers were writing to each other - they would kiss the paper and mark the spot with the cross so the recipient would know where their lips had been and also kiss it. Or they would draw the cross first and then kiss it.