Wikipedia has this to say..."Hugs and Kisses" is a term for a sequence of the letters X and O, e.g. XOXO, typically used by lovers to denote at the end of a written letter or email. X represents a kiss, O a hug.
The use of xoxo goes back to the use of an "X" or cross, which was considered as good as a sworn oath in times before most people could write and therefore used the x in the same way a signature is used today. A mark of your word.
An x at the end of a letter or document was often kissed as a seal of honesty, in much the same way one would kiss a bible or kiss the fingers after making the sign of the cross, thus the x came to represent a kiss in modern times.
The origins of the "O" as a hug are not generally known, although it is speculated that it may represent the arms wrapped around someone being hugged. Another thought is that it came from Jewish immigrants who would sign with an "O" instead of an x because they did not wish to mark their word with the obviously non-Jewish cross the x represented. Perhaps "O" was used because it fits with "X" in the game Tic-Tac-Toe or Noughts and Crosses (O's and X's)...