Like Homer's Iliad and Odyssey, Virgil begins the Aeneid with his story in medias res ("in the middle of things"). Homer's Iliad depicts actions in the tenth and final year of the war; his Odyssey starts ten years after the Trojan War has ended and later flashes back to the time when Odysseus left Troy. Similarly, when Virgil's Aeneid begins, we find Aeneas sailing upon the Mediterranean Sea. It is several years since the fall of Troy. By the time Aeneid 1 ends, Aeneas will be shipwrecked, but safe in northern Africa. In Aeneid 2 and 3, the title character will tell the story of Troy's fall and his various wanderings after the fall of Troy and before he washed ashore in Troy.
O queen, you command me to renew unspeakable grief,
how the Greeks destroyed the riches of Troy,
and the sorrowful kingdom, miseries I saw myself,
and in which I played a great part.
(Aeneid 2; A.S. Kline translation)
Thus, just as Odysseus, in Odyssey 9-12, told the Phaeacians about his adventures, in Aeneid 2-3, Aeneas provides us with a flashback of what he has been doing for the past several years.