This because as soon as you stop moving your mouse, the GetAxis of both, x and y start returning 0, but the Update is still executing; resulting in variables x and y getting 0, and thus your problem. Try keeping this rotation on a mouse button press or something may be? Like: