According to Hindu scripture, the Tulsi plant was a woman named Vrinda (Brinda), a synonym of Tulsi. She was married to the demon-king Jalandhar. Due to her piety and devotion to Vishnu, her husband became invincible. Even god Shiva, the destroyer in the Hindu Trinity could not defeat Jalandhar. So Shiva requested Vishnu - the preserver in the Trinity - to find a solution. Vishnu disguised himself as Jalandhar and tricked Vrinda. Her chastity destroyed, Jalandhar was killed by Shiva. Vrinda cursed Vishnu to become black in colour and he would be separated from his wife. Thus, he was transformed into the black Shaligram stone and in [his Rama] avatar, his wife Sita was kidnapped by a demon-king and thus separated from him. Vrinda then [drowned] herself in the ocean. Eventually Jalandhar was killed by Shiva. The gods or Vishnu transferred her soul to a plant, henceforth which was called as Tulsi.
Another minor legend narrates that Lakshmi - the chief consort of Vishnu - slew a demon on this day and remained on earth as the Tulsi plant.
According to Vaishnavas, it is believed in Puranas that during Samudra Manthana when the gods win the ocean-churning against asuras, Dhanvantari comes up from the ocean with Amrita in hand for the gods. Dhanvantari (the divine medico) sheds happy tears and when the first drop falls in Amrita it forms Tulasi.
That's what the books say, but Tulsi is a herbal plant and is also used for medicinal purposes.