Dido is many readers' favorite characters in the Aeneid, and with good reason. It is clear that Virgil spent a great amount of energy developing her character, and the extended description of her and Aeneas's doomed love affair in Book 4 represents one of Virgil's significant innovations in the genre of epic poetry.
For the earliest precedents to the character of Dido, you'd have to turn to the sorceress Kirke (or Circe) and the nymph Kalypso (or Calypso) from Homer's Odyssey. These women, especially Kalypso, who is holding Odysseus prisoner when the story begins, play a similar role in the plot of the Odyssey as Dido does in the Aeneid: they distract the hero from his main mission of getting home (Virgil puts a different spin on this in the Aeneid by making Aeneas look for his new home.) A more immediate precedent for Dido is the character of Medea in the epic poem The Argonautica by Apollonius of Rhodes. She is similar to Dido in that she is made to fall in love with that poem's hero, Jason, by Eros, the Greek god of desire – just as Dido falls in love with Aeneas because of the influence of Amor, the god of love.
That said, Dido's character in the Aeneid surpasses all of her precursors in complexity and humanity. For one thing, when we first meet Dido, she is already a widow. This distinguishes her by giving her a meaningful past that continues to influence her in the present. As a result of the murder of her husband Sychaeus, Dido has had to flee from Tyre, her home, to North Africa, where she now supervises the building of the new city Carthage. We know that her fledgling kingdom is surrounded by enemies on all sides, and you've got to admire the guts with which Dido determines to hold out against all odds. (We see evidence of this in the increased security she has put in place along the coastline that hassles Aeneas's shipwrecked comrades.) A different sort of threat comes in the form of offers of marriage – for example, from the neighboring North African King Iarbas. So far, she has refused all offers of marriage, determined to remain loyal to the memory of Sychaeus.
But that's just the issue: she is loyal to his memory. Thus, the first thing that Amor, the god of love, does when he sits on her lap in Book 1 is to destroy her memory of her husband to make room for Aeneas in her heart. (This is one of those interesting points where you could argue that the god of love is just acting as a metaphor for what we would understand as the ordinary, psychological process of love, which can also make us forget old attachments. What do you think?)
By the time Amor has finished doing his work, Dido becomes one seriously passionate lady – Virgil describes her feelings of desire as like a fire burning in her marrow. After she and Aeneas hook up in the cave, Dido regards herself as married to the Trojan warrior. That is to say, she is now completely committed. When she learns that Aeneas is leaving, it is earth-shattering – and it is then that the memory of her old husband Sychaeus floods back, filling her with shame. It is in this state that she commits suicide and hurls her vindictive curses at the Trojans. It is also significant that, when we see Dido for the last time, in the underworld, she refuses to speak to Aeneas (or maybe she can't?) and goes to stand with the shade of Sychaeus.