Character Controller - rotation changes z axis

Hello, I am new to Unity and just trying to implement character controller. I do have a problem with move movement - where I am rotating vertical movement around x-axis and horizontal around y-axis. What I do not understand though is that also z-axis rotation is applied.

Here is my code:

private void Rotate()
{
	rotationX += rotateUD * SensitivityX;
	rotationY += rotateLR * SensitivityY;

	Quaternion quaternionX = Quaternion.AngleAxis(rotationX, Vector3.left);
	Quaternion quaternionY = Quaternion.AngleAxis(rotationY, Vector3.up);

	transform.localRotation = originalRotation * quaternionX * quaternionY;
	Debug.Log(quaternionY);
}
private void GetInputs()
{
	moveLR = Input.GetAxis("Horizontal");
	moveFB = Input.GetAxis("Vertical");
	rotateUD = Input.GetAxis("Mouse Y");
	rotateLR = Input.GetAxis("Mouse X");
}

If I debug quaterninX and quaternionY, both have z vector as 0. Therefore I am really confused.
Thanks for hint.

I think problew is the way how you rotate. originalRotation may have non zero z rotation and when you multiply you are getting non zero z as result. I suggest you to use Transform.Rotate( ) instead its much easier

I made a progress, but it’s still unclear to me. I have two coded. One works and second does not.

Working code (very simmilar to posted above):

	rotationX += Input.GetAxis("Mouse Y") * MovementSpeed;
	rotationY += Input.GetAxis("Mouse X") * MovementSpeed;

	Quaternion quaternionX = Quaternion.AngleAxis(rotationX, Vector3.left);
	Quaternion quaternionY = Quaternion.AngleAxis(rotationY, Vector3.up);

	transform.localRotation = originalRotation * quaternionY * quaternionX;

Bad code (rotates also around z-axis):

	rotationX = Input.GetAxis("Mouse Y") * MovementSpeed;
	rotationY = Input.GetAxis("Mouse X") * MovementSpeed;

	transform.Rotate(rotationX, rotationY, 0);

Can somebody explan the problem? It looks like I am missign some king of very basic.