When Elena first showed up in The Vampire Diaries, she fell in love with Stefan and that was who she seemed destined to be with. Stefan was very protective of her and Damon was mostly a jerk, who seemed to care more about his own selfish desires than anyone around him. However, what Elena never knew was that she met Damon first. They shared a moment in the rain, and he was always who she was meant to be with. So, when does Elena choose Damon? She chose him earlier than even she knew, but he wiped her memory, and their time together was delayed.
It was in the second season when Elena saw a very different side of Damon and realized that he might be the one for her - and not Stefan.
By The Vampire Diaries season 6, Damon and Elena finally admitted their love for each other. By this time, it was too late. Just as they finally revealed how much they loved each other, and Elena chose Damon in The Vampire Diaries, she fell into a curse and ended up in a coma.
Played by Paul Wesley, Stefan bursts into Elena's life after saving her from a car accident. The pair quickly bonded and, despite a few bumps in the road, Elena and Stefan formed a romantic relationship. Throughout The Vampire Diaries seasons 1 and 2, Elena and Stefan served as the show's central couple.
However, things began to change when Stefan turned his humanity off and left town with Klaus Mikaelson (Joseph Morgan). Despite continuously searching for him, Elena and Damon began spending more time together, growing closer. However, both of them remained intent on staying loyal to Stefan. Damon continued helping to reunite them, even at the expense of his own happiness. By the end of The Vampire Diaries season 3, Elena accepted that she had feelings for Damon but ultimately chose to be with Stefan.
Things changed further still when, in The Vampire Diaries season 4, episode 1, "Growing Pains," Elena completed her transition into a vampire. It was previously established that a side effect of that particular transformation is heightened emotions. Elena would especially fall prone to those during her time as a vampire. That was most notably prevalent during her grief following the death of her brother, Jeremy (Steven R. McQueen).
However, it also played a component in her eventually choosing Damon in The Vampire Diaries season 4, episode 23, "Graduation." As a human, Elena was more effectively able to compartmentalize her feelings for Damon and prioritize her loyalty to Stefan.
Another fortunate side effect of transition is that previous compulsions are undone. As a result of becoming a vampire, Elena became once again privy to all the times that Damon had wiped her memory. These moments tended to be occasions where Damon had revealed his true feelings — getting it off his chest before removing any trace of it from her mind. Equally, it allowed Elena to witness Damon Salvatore's oft-unseen selfless side.
The return of all Elena's missing memories also enlightened her to the fact that she'd met, and been charmed by, Damon before encountering Stefan. The Vampire Diaries season 4 conveyed that she didn't have all the information when she previously chose Stefan. This idea would be explored again in The Vampire Diaries season 6. After Damon seemed to have died, Elena had all memories of ever loving him erased. As a result, she fiercely disliked him. Upon turning human, though, Elena's memories were once again restored.
Armed with full knowledge (and memories) of everything that had taken place over the years, coupled with her heightened emotions, it allowed her to make a more informed choice. It became clear that Damon was the one for her after all — not once but twice — with Elena realizing that "even in death, Damon was the one that made her feel most alive." Though their romance would hit a few more obstacles along the way, that fact remained true — right up until the end of The Vampire Diaries and beyond.
In Legacies, Damon and Elena are mentioned several times — particularly by Josie Saltzman. In Legacies season 3, episode 9, she tells Ric that she's been staying with Damon and Elena, and invites him over to their home. While the couple has yet to appear on the show, a little can be ascertained about their lives during the spinoff. The pair seems to be happy and healthy, with Elena working as a doctor in Mystic Falls. She and Damon are now married, and they have a daughter named Stephanie Salvatore who is attending Mystic Falls High School. It's a fitting end for The Vampire Diaries couple and a happy one at that.