There's wide scholarly agreement that, originally, 666 was used to semi-cryptically denote the first century Roman emperor Nero -- referred to as the "beast" in the 13th chapter of the Book of Revelation.
Re: the Hebrew alphabet, there's a system called gematria where individual letters have numbers assigned to them; and early Jews would sometimes make reference to things and people by the calculated sum of the assigned numbers of the letters that comprise a word/name. For the name "Nero Caesar," the sum here is 666. (For more detail than you'd probably want ever on this, see my comment here.)
Eventually, as time elapsed past the first century, the identification of the beast as Nero in particular fell out of favor,. The "beast" became a sort of archetypal evil figure, who people could identify with any number of contemporary or future figures. Also, many of the vague "end times" personages referred to in the New Testament -- some clearly separate figures -- became conflated.
In any case, as the beast was a sort of archetypal villain, it was pretty easily associated with Satan -- also an archetypal Christian villain. It probably didn't hurt that the beast is described in Revelation 13 as having "horns," in conjunction with the popular image of the devil and his horns.