It originated in ancient Rome as the fertility festival, the Lupercalia, which was celebrated on February 15th. Later, the nearest Christian feast-day was St Valentine's on the 14th, so when pagan festivals were superseded by Christian ones, the date was moved back one day. Supposedly, Valentine was the name of two separate Christian martyrs.
Also, the date is roughly when birds start to look for a mate, according to legend. Thus, there were two reasons - fertility and mating - for making this the day for lovers.