When changing a rig from generic to humanoid it breaks the animation

I made a character in blender base on the blender build in metarig and imported into unity. (no new bones are added and nothing has been change to the metarig)

The animation that I created for this character works fine in the generic mode and appear the same as the animation in blender. But when I change it to Humanoid mode the animations messes up and the arms and legs are rotated but when I go into blender the animations are how they are meant to be.

Most likely the metarig (Max artist guess) doesn’t match the humanoid rig structure in Unity.
What Is the a reason you are setting up for humanoid?

To have a skeleton play nice with mecanim humanoid - the rig MUST match the humanoid rig structure.
This isn’t 100% true for more experienced users of mecanim, but for users not experienced in setting up complex avatar and transform masks, and setting up detailed state machines to control the different layers within a more complex skeleton - the statement is true.

Match the humanoid rig structure from Unity - in blender and all will be fine when bringing in to Unity.