Paul explained in Romans 7:7-9 that without the Law people didn't recognize that they sinned. Paul mentioned covet because it was an internal sin of the mind and harder to avoid compared to keeping the laws through external actions. Transgressions is another word for sins. As Paul describes below, the Law was given so that people would know they sinned/transgressed. Transgression implies breaking a law. Sin implies missing the mark. So, they have different implications, but describe the same actions.
What then shall we say? That the law is sin? By no means! Yet if it had not been for the law, I would not have known sin. For I would not have known what it is to covet if the law had not said, “You shall not covet.” 8 But sin, seizing an opportunity through the commandment, produced in me all kinds of covetousness. For apart from the law, sin lies dead. 9 I was once alive apart from the law, but when the commandment came, sin came alive and I died.
(Rom. 7:7–9, ESV)
To some degree people were aware of sin before the Law, but not to its fullest extent.
For when Gentiles, who do not have the law, by nature do what the law requires, they are a law to themselves, even though they do not have the law. 15 They show that the work of the law is written on their hearts, while their conscience also bears witness, and their conflicting thoughts accuse or even excuse them 16 on that day when, according to my gospel, God judges the secrets of men by Christ Jesus.
(Rom. 2:14–16, ESV)
Remember Adam did violate one command/law, not to eat from the tree of the knowledge of good and evil. The ten commandments were especially important for Israel from which the Messiah would come because, while the surrounding cultures might have do not murder and do no steal, they did not have worship the one God only and don't have any graven images. Israel was always in danger of loosing that distinctive; thus the captivity.
The other aspect of Gal. 3 is the παιδαγωγὸς, which has no equivalent to translate into English. It was a servant who went with the child to school to make sure the child behaved and accomplished his lessons. Thus, the other aspect of because of transgressions was to guard Israel from transgressions until Christ came. Not that they didn't transgress, but that they were absorbed into the idolatry of the surrounding nations. The concept of captive under the Law is Israel under a παιδαγωγὸς until Christ came bringing grace.
Now before faith came, we were held captive under the law, imprisoned until the coming faith would be revealed. 24 So then, the law was our guardian (παιδαγωγὸς) until Christ came, in order that we might be justified by faith.
(Gal. 3:23–24, ESV)
παιδαγωγός, οῦ, ὁ (..) attendant (slave), custodian, guide, lit. ‘boyleader’, the man, usu. a slave (Plut., Mor. 4A, B), whose duty it was to conduct the boy or youth (Plut., Mor. 439F) to and from school and to superintend his conduct gener.; he was not a ‘teacher’ (despite the present mng. of the derivative ‘pedagogue’ [cf. Murray, New (Oxford) Engl. Dict.
--
Arndt, W., Gingrich, F. W., Danker, F. W., & Bauer, W. (1979). A Greek-English lexicon of the New Testament and other early Christian literature : a translation and adaption of the fourth revised and augmented edition of Walter Bauer’s Griechisch-deutsches Worterbuch zu den Schrift en des Neuen Testaments und der ubrigen urchristlichen Literatur (p. 603). Chicago: University of Chicago Press.
The captivity of the παιδαγωγός is the curses for not following the Law. These curses lead to the captivity of Israel and Judah. The remnant of Judah that returned after the captivity no longer worshipped idols.
“But if you will not obey the voice of the LORD your God or be careful to do all his commandments and his statutes that I command you today, then all these curses shall come upon you and overtake you.
(Deut. 28:15, ESV)
Your sons and your daughters shall be given to another people, while your eyes look on and fail with longing for them all day long, but you shall be helpless. 33 A nation that you have not known shall eat up the fruit of your ground and of all your labors, and you shall be only oppressed and crushed continually,
(Deut. 28:32–33, ESV)
You shall father sons and daughters, but they shall not be yours, for they shall go into captivity.
(Deut. 28:41, ESV)