What's the difference between the associative law and the commutative law?

The commutative law says that $X \circ Y = Y \circ X$ where $\circ$ is the operation under consideration (addition, multiplication, what have you). In words, you can swap the order of the two inputs of the operation and it won't matter.

The associative law says that $(X \circ Y) \circ Z = X \circ (Y \circ Z)$, where the parentheses tell you what you should be doing first. As you can tell, it's quite different: this is no longer about changing the order of the "things" you operate on, but rather the order of the operations themselves.

Suppose the "things" are permutations of 3 objects (so that "swap 1 and 2" and "move 1 to 2, 2 to 3 and 3 to 1" are legitimate "things"), and the "operation" is "do the first and then the other". You can see for yourself that the commutative law is not satisfied (try swapping 1 2 and then 2 and 3 vs doing it in the opposite order), but the associative law is.