Odysseus led 12 ships to Troy, according to the Catalogue of Ships in Book 2 of Homer's Iliad. His contingent came from the islands and settlements associated with his kingdom, especially Ithaca, Same, Dulichium, and Zacynthus.
The number appears in a formal list of Achaean commanders, homelands, and ships assembled for the Trojan expedition. Odysseus is presented as the leader of these twelve vessels, not as commander of the entire Greek army. Agamemnon held the overall supreme command, while other kings led their own contingents.
The figure is easy to confuse with other totals in the poem. Achilles brought fifty ships from Phthia, Ajax the Great brought twelve from Salamis, and many larger kingdoms contributed substantially more. The catalogue is counting ships, not individual warriors, so it does not mean Odysseus had only twelve soldiers.
The Odyssey later begins with Odysseus trying to return home after Troy. Its adventures concern the surviving crew of his own ship after disasters at sea; that later narrative should not be mistaken for the original twelve-ship muster.