When I read "The Song of Achilles", the book made repeated mentions of a wound on Odysseus's leg long before the Trojan War, but never really explains how he got it. What is the story behind it?
This story is told in one of the books that The Song of Achilles is based upon, Homer's Odyssey. Note that Odysseus is referred to as 'Ulysses' in this version.
Then the old woman took the cauldron in which she was going to wash his feet, and poured plenty of cold water into it, adding hot till the bath was warm enough. Ulysses sat by the fire, but ere long he turned away from the light, for it occurred to him that when the old woman had hold of his leg she would recognize a certain scar which it bore, whereon the whole truth would come out. And indeed as soon as she began washing her master, she at once knew the scar as one that had been given him by a wild boar when he was hunting on Mount Parnassus with his excellent grandfather Autolycus- who was the most accomplished thief and perjurer in the whole world- and with the sons of Autolycus. Mercury himself had endowed him with this gift, for he used to burn the thigh bones of goats and kids to him, so he took pleasure in his companionship. It happened once that Autolycus had gone to Ithaca and had found the child of his daughter just born. As soon as he had done supper Euryclea set the infant upon his knees and said, you must find a name for your grandson; you greatly wished that you might have one."
When the child of morning, rosy-fingered Dawn, appeared, the sons of Autolycus went out with their hounds hunting, and Ulysses went too. They climbed the wooded slopes of Parnassus and soon reached its breezy upland valleys; but as the sun was beginning to beat upon the fields, fresh-risen from the slow still currents of Oceanus, they came to a mountain dell. The dogs were in front searching for the tracks of the beast they were chasing, and after them came the sons of Autolycus, among whom was Ulysses, close behind the dogs, and he had a long spear in his hand. Here was the lair of a huge boar among some thick brushwood, so dense that the wind and rain could not get through it, nor could the sun's rays pierce it, and the ground underneath lay thick with fallen leaves. The boar heard the noise of the men's feet, and the hounds baying on every side as the huntsmen came up to him, so rushed from his lair, raised the bristles on his neck, and stood at bay with fire flashing from his eyes. Ulysses was the first to raise his spear and try to drive it into the brute, but the boar was too quick for him, and charged him sideways, ripping him above the knee with a gash that tore deep though it did not reach the bone. As for the boar, Ulysses hit him on the right shoulder, and the point of the spear went right through him, so that he fell groaning in the dust until the life went out of him. The sons of Autolycus busied themselves with the carcass of the boar, and bound Ulysses' wound; then, after saying a spell to stop the bleeding, they went home as fast as they could. But when Autolycus and his sons had thoroughly healed Ulysses, they made him some splendid presents, and sent him back to Ithaca with much mutual good will. When he got back, his father and mother were rejoiced to see him, and asked him all about it, and how he had hurt himself to get the scar; so he told them how the boar had ripped him when he was out hunting with Autolycus and his sons on Mount Parnassus.