What was the purpose of the Tree of the knowledge of good and evil

And what would have happened had Eve eaten it and Adam didn’t? Or vice versa?