The "tree of knowledge of good and bad" was a literal tree that produced fruit (Gen 2:16,17), just as the "tree of life" was a literal tree that produced fruit that granted it partakers life forever.(Gen 3:22) But "the tree of knowledge of good and bad" was created specifically by God (whose personal name is Jehovah) as a test for Adam and Eve, to see where their loyalty resided.(Note: Even the angels were never subjected to a test, for they are spirits that do not have the plethora of desires or needs of humans, such as the need for food and water, to breath, to reproduce or sexual desire, that can pull us in all sorts of directions that show how fragile we are, how desires can overwhelm us; see Ps 103:14-16 in which it says that Jehovah "knows how we are formed, remembering that we are dust. As for mortal man, his days are like those of grass.....when the wind blows, it is no more, as though it was never there")
This tree represented Jehovah's right to set moral boundaries for humans, unlike the animal creation. At Genesis 2:16,17, God tells Adam that he can enjoy fruit from all the trees in the garden of Eden, except one, the "tree of knowledge of good and bad" that he set apart from the others.
God told Adam that the consequences for violating the command to not eat from "the tree of knowledge of good and bad" would be death.(Gen 2:17b) Adam, then passed this command on to his wife Eve.(Gen 3:2,3) The "tree of knowledge of good and bad" established what Psalms 103:19 states: "Jehovah has firmly established his throne in the heavens; and his kingship rules over everything".
But with this test arose the issue of universal sovereignty, because the "serpent" (or Satan, Rev 12:9 who had been given oversight of the garden of Eden, being "assigned....as the anointed covering cherub (that was) faultless in your ways from the day you were created", Eze 28:12-15) came to long for what only rightly belonged to Jehovah - worship.(Satan has never relinquished his desire for worship, asking from Jesus just one act of worship in order to receive all the kingdoms of the world, Luke 4:7, 8)
Hence, he took advantage of the weakest link - Eve - seducing her by calling into question God's right to rule (1 Tim 2:14; 2 Cor 11:3), casting doubt by asking her: "Did God really ("really", Hebrew aph meaning to take up a position to express opposition) say that you must not eat from every tree of the garden ?"(Gen 3:1)
Eve responded by telling the "serpent" that her and Adam could eat from all the trees except one - "the tree that is in the middle of the garden".(Gen 3:2,3) With this response, the "serpent" or Satan (meaning "resistor") now says to Eve, becoming the "father of the lie"(John 8:44): "You certainly will not die. For God knows that in the very day you eat from it, your eyes will be opened and you will be like God, knowing good and bad".(Gen 3:4, 5)
Eve "took the bait", wanting to "be like God, knowing good and bad", being able to decide for herself what she felt was right and wrong without having Jehovah set moral standards for her and reached out and took fruit from the forbidden tree, whereby later she offered it to Adam, who sided with her in the rebellion against God's rulership.(Gen 3:6)
Now the issue of sovereignty was in full motion, whereby Jehovah's right to rule was challenged. And who else became involved in this universal issue ? The angels that were watching from heaven as this scenario unfolded. Jehovah could have destroyed all three rebels, but this would not have settled the doubt of whether man (or even angels) could successfully rule themselves apart for God.
Thus, Jehovah handed the reigns of the "world" (or children born to Adam and Eve that also became rebels like their "father" Adam, see Eph 2:2 that says that true Christians "at one time walked according to the system of things of this world, according to the ruler of the authority of the air, the spirit (or dominant rebellious force) that is now at work in the sons of disobedience") over to Satan to have, to allow a lot of time to pass (some 6,000 years) in order to prove that his way of ruling is defective, resulting in misery and destruction and death.(see John 14:30, in which Jesus calls Satan the "ruler of the world")
At the end of Jesus millennial reign, the issue of universal sovereignty will be settled once and for all, with all who have rebelled against Jehovah being decimated.(Rev 20:7-10; the battle of Armageddon does not settle the issue of universal sovereignty [but sets the tone for all who are rebels against God's sovereign rule], because one thousand years later, others among mankind who have been privileged to either pass through the "great tribulation" [Rev 7:14] or receive a resurrection from the dead call into question God's right to rule [Rev 20:8])
After this, never again will anyone be able to have any success in calling into question Jehovah's right to rule. Thence, the "tree of knowledge of good and bad" was the starting point for Jehovah to set moral boundaries for humans, who are made in his "image".(Gen 1:26, able to grasp what justice truly is, what is "right and wrong" in Jehovah's eyes)