Place carrots in a large bowl. Sprinkle garlic over carrots.
Mix vinegar, sugar, and salt together in a small bowl.
Heat oil in a skillet over medium heat. Cook and stir onion in hot oil until soft and translucent, 5 to 7 minutes. Stir coriander and cayenne pepper into the onion; add to carrot mixture and toss. Pour vinegar dressing over carrot mixture; toss to coat.
Transfer carrot salad to a dish with a tight-fitting lid, cover, and refrigerate 4 to 24 hours, tossing salad several times while it marinates.