Antimetabole
In rhetoric, antimetabole is the repetition of words in successive clauses, but in transposed order; for example, "I know what I like, and I like what I know". It is related to, and sometimes considered a special case of, chiasmus.
An antimetabole... Wikipedia