How to stop the character's movement to change direction when rotating the camera?

If you look in the Event Graph of your Third Person Character you will have a few commented blocks.
One is labelled Movement Input and contains your InputAxis MoveForward and the MoveRight events.
See the Get Control Rotation (target is pawn) node? Mouse over it and the tooltip will tell you ‘Get the rotation of the controller, often the view rotation of this pawn’. What it means in practice is that this is the direction of the camera.
So, replace this node with ‘Capsule Component’ followed by ‘GetWorldRotation’ and feed this into the Break Rotator node instead of the ‘Get Control Rotation’. Maybe that will suit you or at least get you started.