How to configure position of object?

I’m very new to unity and game development, I’m trying to configure the position of object, using following code in update method:

void Update () {

		if (Input.GetKey(KeyCode.W)) {
		
			player.transform.position += transform.forward;
			
		}
	}

but the player object also rotating automatically. I’m not instructing it to rotate then why it is happening? The player object is a car, which I’m trying to position on ground.

I do not see where the rotation comes from in this code. I might be from something else you are doing.

The += operator will not work on properties, if I remember correctly. (transform.position is a c# property, not a variable/member)

You should use the Translate-function provided in the transform-class. It is the easiest to use and the hardest to make mistakes. The reference is here.