Legend has it that in 270 AD, the Roman Emperor Claudius II ordered the death of a priest named Valentine. St. Valentine came to the attention of Claudius because of his secret interference with orders banning marriage.
Claudius II had been raging deadly campaigns but was having trouble getting soldiers to join his leagues. He believed that their reluctance was because of their love for their wives and families. Claudius' answer to the problem was to ban marriages and engagements in Rome. Valentine dared to defy him and continued to perform marriages in secrecy.
When Claudius discovered Valentines actions he ordered him to be put to death. Valentine's sentence was carried out on February 14, 270 AD. He was beaten to death with clubs and beheaded.
After his great service the church named him a saint.
Truth be told, there are 3 Saint Valentines in the Catholic Encyclopedia who were all martyrs and were all put to death on February 14. Thus, "as legend has it."