In Ancient Rome, Lupercalia, observed February 13 through 15, was an archaic rite connected to fertility. Lupercalia was a festival local to the city of Rome. The more general Festival of Juno Februa, meaning "Juno the purifier "or "the chaste Juno," was celebrated on February 13–14. Pope Gelasius I (492–496) abolished Lupercalia.
A commemorative feast was established in 496 by Pope Gelasius I. It is a common opinion that the Christian church may have decided to celebrate a Valentine's feast day in the middle of February in an effort to Christianize celebrations of the pagan Lupercalia.
Reference 1, Reference 2