Nancy Hedford was a Federation Assistant Commissioner in 2267. That year, she was dispatched to Epsilon Canaris III to prevent the outbreak of war. But she could not complete her mission; she developed the extremely rare, always fatal Sakuro's Disease, forcing the Federation to recall her for medical treatment. She was extremely bitter about this recall, blaming her illness on the incompetence of Starfleet Medical. She believed she should have been properly vaccinated, despite Doctor McCoy's statement that the odds against developing Sakuro's Disease were literally billions to one.
The USS Enterprise sent a shuttlecraft to retrieve the Commissioner so that she could be ferried to an appropriate medical facility. En route back to the starship, an alien called the Companion seized control of the shuttlecraft, diverting it to a small planetoid in the Gamma Canaris region. This posed a problem because, while Sakuro's Disease was curable in a medical facility, it was guaranteed to be fatal outside of such a facility. Marooned, Nancy Hedford faced certain death.
Living on the planetoid was Zefram Cochrane, inventor of the warp drive, and the Companion. Cochrane "felt" to the Companion a need for more human companionship. He hoped the alien would free him to seek this elsewhere, but instead it brought nearby Humans to it.
Various attempts to persuade the Companion to cure Nancy Hedford, or to free its human charges all failed, until Captain Kirk realized it was in love with Cochrane, and presented its differences as an eternal barrier to that love; he hoped this would at last convince the alien to free the Humans -- love expressed as sacrifice. Instead, the Companion elected to merge with Nancy Hedford, who was moments from succumbing to her illness. To do this, the creature abandoned its immortality and its suite of powers. The combined Hedford/Companion entity and Cochrane remained on their small planetoid, there to live out the remainder of a normal human lifespan. (TOS: "Metamorphosis")