To be crazy like a fox is to do something that appears foolish but is actually cunning or shrewd. Sources seem to agree the phrase became popular after humorist S.J. Perelman used it as the title of a book in 1944. Beyond that, the origin of the phrase seems obscure. Online Etymology Dictionary says “crazy like a fox” has been recorded since 1935 but does not mention the first usage.
While the specific phrase seems to date from the first half of the 20th century, foxes have often been considered to be cunning creatures. Some sources mention Aesop’s Fables (attributed to Aesop around 600 BCE) as examples of early stories of cunning foxes, but one extensive collection has stupid-fox as well as cunning-fox fables.