"The Lord God commanded the man, saying, “From any tree of the garden you may eat freely; 17 but from the tree of the knowledge of good and evil you shall not eat, for in the day that you eat from it you will surely die,” (Gen. 2:17).
The tree symbolized the knowledge of good and evil. Adam was in a sinless state and was warned by God not to partake of the tree. It is probably because with the knowledge of good and evil comes the knowledge of sin. To partake of the tree would have been to seek not only the knowledge of good, but also of evil. The knowledge of sin, of evil, is to seek that which is against the very nature of God's holiness. And, by partaking of that knowledge, Adam would be separated from God. After all, holiness requires nothing less than itself.
Why put the tree there in the first place? Why not just leave it out of the garden? It would seem that because Adam was made in the image of God (Genesis 1:26), and being in that image means to learn, to know, to inquire, to be rational, etc., it would be natural for Adam to become aware of that which would be against God. Perhaps God put the tree there as a proper and necessary warning to Adam not to partake of that which would lead to sin.