Let's take note of a few vital points.
(1) It was God Himself who named the tree, "the tree of the knowledge of good and evil." The name given for the tree cannot be a misnomer in any way, but accurate and precise, because God knows all things[e.g. Psalm 147:5, 1 John 3:20] and cannot lie[e.g. Romans 3:4, Hebrews 6:18]. Thus, when God calls the tree "the tree of the knowledge of good and evil", He calls it that because that is what it does; give the knowledge of good and evil.
Genesis 2:17 "but from the tree of the knowledge of good and evil you shall not eat, for on the day that you eat from it you will certainly die."
(2) God knew that the man had the ability to follow His command. If he didn't, God would not have given the commandment to him in the first place. But with the ability to follow comes the ability to not follow. We shall see why this is the case.
Genesis 2:15-17 "Then the Lord God took the man and put him in the Garden of Eden to cultivate it and tend it. 16 The Lord God commanded the man, saying, "From any tree of the garden you may freely eat; 17 but from the tree of the knowledge of good and evil you shall not eat, for on the day that you eat from it you will certainly die."
(3) Is the tree of the knowledge of good and evil is bad? It can't be, because everything that God directly creates is good and can only be good. In the first chapter of Genesis, God creates the whole universe and everything in it, and notices that it is all good seven times; at the seventh, He notices that it was very good. Therefore, the tree of the knowledge of good and evil is good, because it serves a God-ordained purpose. We shall see just what that is exactly.
Genesis 1:31 "And God saw all that He had made, and behold, it was very good. And there was evening and there was morning, the sixth day."
Genesis 2:9 "Out of the ground the Lord God caused every tree to grow that is pleasing to the sight and good for food; the tree of life was also in the midst of the garden, and the tree of the knowledge of good and evil."
What About Knowledge Itself?
So far what we know about the tree is that it is good in some way or another, that God knows the man can choose to follow His command, and that the tree of the knowledge of good and evil is just that, i.e. it gives the knowledge of good and evil. We know all that about the tree, but what about the knowledge of good and evil itself? The tree must be good because God directly created it; but knowledge of any kind isn't something that God creates per se(it is certainly something that God can give), so is such knowledge(of good and evil) inherently good or bad? First, let's take a look at the Hebrew word for "knowledge". The word is דַּ֫עַת, pronounced da'at. Here are a few of the many places where the word is used in the Hebrew Bible.
Genesis 2:17 "but of the tree of the knowledge[דַּ֫עַת] of good and evil you shall not eat, for in the day that you eat of it you shall surely die."
1 Kings 7:14 "He was the son of a widow of the tribe of Naphtali, and his father was a man of Tyre, a worker in bronze. And he was full of wisdom, understanding, and skill[דַּ֫עַת] for making any work in bronze. He came to King Solomon and did all his work."
Job 34:34-37 "Men of understanding will say to me, and the wise man who hears me will say: 35 'Job speaks without knowledge[דַּ֫עַת]; his words are without insight.' 36 Would that Job were tried to the end, because he answers like wicked men. 37 For he adds rebellion to his sin; he claps his hands among us and multiplies his words against God."
Proverbs 1:7 "The fear of the Lord is the beginning of knowledge[דַּ֫עַת]; fools despise wisdom and instruction."
Proverbs 1:29 "Because they hated knowledge[דַּ֫עַת] and did not choose the fear of the Lord,"
Proverbs 9:10 "The fear of the Lord is the beginning of wisdom, and the knowledge[דַּ֫עַת] of the Holy One is insight."
Proverbs 18:15 "An intelligent heart acquires knowledge[דַּ֫עַת], and the ear of the wise seeks knowledge[דַּ֫עַת]."
Knowledge(דַּ֫עַת) in the Bible isn't just knowing things, which is how we think of knowledge today. Hiram had wisdom and understanding, and the knowledge he had was a skill with working with bronze. You don't learn a skill by knowing things; you learn it by practicing. In the passage in Job, knowledge is treated synonymously with insight. In Proverbs 1:7, the fear(יִרְאָה[yirah]) of the LORD(i.e. total reverence, respect, and adoration for God that leads one to abide by His commandments, not terror/dread in particular) is the beginning of knowledge! And then in Proverbs 9:10, the same concept is reiterated as the fear of the LORD is the beginning of wisdom, and it follows with knowledge once again being synonymous with insight. Finally, in Proverbs 18:15, knowledge is said to be something that both the intelligent and the wise seek for and acquire.
In the majority of the Hebrew Bible, knowledge is painted in a positive light. The story in Genesis is one of the only places where it is painted in a negative light; where to acquire it means sure death. The point is, knowledge, in and of itself, is not a bad thing at all, and can be very good(lead to insight, wisdom, understanding, discernment, etc.). So, the phrase "knowledge of good and evil" would probably be better off as "the ability/skill to discern between good and evil." And that is what I am going to treat it as; the two phrases will be synonymous from now on. Now, what about knowing "good and evil." How many places is that mentioned in the Bible? Well, not many places. Let's see them.
Genesis 2:17 "but of the tree of the knowledge of good and evil you shall not eat, for in the day that you eat of it you shall surely die."
Genesis 3:22 "Then the Lord God said, “Behold, the man has become like one of us in knowing good and evil. Now, lest he reach out his hand and take also of the tree of life and eat, and live forever—"
Deuteronomy 1:39 "And the little ones you said would become captives—your children who on that day did not know good from evil—will enter the land that I will give them, and they will possess it."
1 Kings 3:9 "So give Your servant an understanding heart to judge Your people to discern between good and evil. For who is able to judge this great people of Yours?"
Isaiah 7:16 "For before the boy knows enough to reject evil and choose good, the land of the two kings you dread will be laid waste."
In Deuteronomy 1:39, the "little ones" who did not know good from evil were Israelites below 20 years of age(which was generally the age one reached adulthood in Israel). So, not knowing good and evil is associated with being young. So, was it a good thing that they didn't know good and evil? No! In Deuteronomy 31, Moses talks about how the generation of "little ones" who did not know good and evil was going to turn out exactly like the last generation.
Deuteronomy 31:27 "For I know thy rebellion, and thy stiff neck: behold, while I am yet alive with you this day, ye have been rebellious against the LORD; and how much more after my death?"
Not knowing good and evil didn't make them any more righteous than the previous generation, and it didn't indicate that they would have a better future; according to Moses, quite the opposite. What about 1 Kings 3:9? That's when Solomon was taking God up on His offer to ask Him what he wishes for God to give him. How did God respond when Solomon asked for the knowledge to discern between good and evil?
1Kings 3:10 "It was pleasing in the sight of the Lord that Solomon had asked this thing."
It was pleasing to God! But that doesn't match with how God responded to Adam and Eve wanting the knowledge of good and evil... He banished them from the garden, dooming them to death. God cannot contradict Himself, so perhaps this gives us a clue; that the knowledge of good and evil Adam and Eve wanted wasn't the same knowledge of good and evil that Solomon wanted. Now, what about Isaiah 7:16? Well, in order for one to choose good, you must first know what good is; likewise, in order for one to reject evil, you have to know what evil is. Essentially, you need the ability to discern between good and evil.
Ok, so what other things did we learn? Well, we know that knowledge is not a bad thing, and is usually very positive. We also learned that discerning between good and evil is also not bad. So, knowledge, as well as the ability to discern between good and evil, are things we should pursue... which makes the Genesis story so much more confusing. That is exactly what Adam and Eve were doing! Pursuing the knowledge of good and evil! So, why did God punish them? Well, now is the time we read the story of Adam, Eve, and the tree of the knowledge of good and evil, keeping everything we've learned so far in mind.
Genesis 2:9; 16,17 "Out of the ground the Lord God caused every tree to grow that is pleasing to the sight and good for food; the tree of life was also in the midst of the garden, and the tree of the knowledge of good and evil."; "The Lord God commanded the man, saying, "From any tree of the garden you may freely eat; 17 but from the tree of the knowledge of good and evil you shall not eat, for on the day that you eat from it you will certainly die."
Genesis 3:1-7 "Now the serpent was more cunning than any animal of the field which the Lord God had made. And he said to the woman, “Has God really said, ‘You shall not eat from any tree of the garden’?” 2 The woman said to the serpent, “From the fruit of the trees of the garden we may eat; 3 but from the fruit of the tree which is in the middle of the garden, God has said, ‘You shall not eat from it or touch it, or you will die.’” 4 The serpent said to the woman, “You certainly will not die! 5 For God knows that on the day you eat from it your eyes will be opened, and you will become like God, knowing good and evil.” 6 When the woman saw that the tree was good for food, and that it was a delight to the eyes, and that the tree was desirable to make one wise, she took some of its fruit and ate; and she also gave some to her husband with her, and he ate. 7 Then the eyes of both of them were opened, and they knew that they were naked; and they sewed fig leaves together and made themselves waist coverings."
Genesis 3:22 "Then the Lord God said, "Behold, the man has become like one of Us, knowing good and evil; and now, he might reach out with his hand, and take fruit also from the tree of life, and eat, and live forever—""
What Does It All Mean?
Ok, so what do we know? The tree gives the ability to discern between good and evil. Also, God created(caused to grow) the tree of the knowledge of good and evil, so it's good and serves a purpose given by Him. God also commanded the man not to eat of the tree. Perhaps the purpose of the tree is connected to God commanding the man not to eat of the tree, i.e. the purpose of the tree is to be a test for the humans. A test to see if they would abide by God's commandments. Hey, you know what that reminds me of... Proverbs 1:7, the fear of the LORD is the beginning of knowledge(cf. Proverbs 9:10). So, if Adam and Eve were to have a fear of God and keep His commandment to not try to attain knowledge of good and evil(which itself is wisdom, remember what Solomon asked for?) from the tree, doing so would then lead them to attain knowledge and wisdom. So, by refraining from trying to gain knowledge and wisdom by themselves, they would gain knowledge and wisdom(because the fear of the LORD is the beginning of wisdom and knowledge). But then, by whom would they learn good and evil, if not by themselves? Well, God of course!
That's the purpose of the tree! To be a test for God to see who the humans were going to trust to attain wisdom and knowledge. To not eat of the tree would be to follow His command(fear of the LORD), and it would signify to God that they want to trust Him to teach them what good and evil are; trust Him to give them the ability to discern between good and evil. And to eat of the tree would be to break His command(not have a fear of the LORD), and would signify to God that they want to trust themselves to learn good and evil; trust in themselves to gain the ability to discern between good and evil.
And this is also why God had to give the humans the ability to willingly obey or disobey His command. By choosing to not disobey His command and follow it instead, God could know that they trust Him to teach them good and evil. But if they were incapable of disobeying His command, then they could never choose to not disobey it. You see that, right? If they did not have the ability to disobey God at all, that would mean there's a 0% chance that they would disobey Him, which would then mean that there's a 100% chance that they would obey Him! You can't willingly choose one thing over another thing if you are only able to choose one thing and entirely unable to choose the other. That is not a choice. Thus, if God didn't give them the ability to disobey His commands, they could only ever obey His commands, and thus they could never choose to obey His commands, and God could not know if they truly trust Him over themselves.
Now, remember the clue that we learned from the story of Solomon? That the knowledge of good and evil Adam and Eve wanted wasn't the same knowledge of good and evil that Solomon wanted. Why wasn't it? Well, when Solomon asked for the knowledge of good and evil, God was pleased. And when Adam and Eve ate of the tree of the knowledge of good and evil, God was clearly displeased. What's the difference? Solomon asked God to give Him the knowledge of good and evil. Did Adam and Eve ask God? No! Remember, eating the fruit of the tree would signify to God that they trust themselves to learn good and evil and wanted to teach themselves how to discern between them. But Solomon asked God to teach him good and evil, thus this signified to God that Solomon trusted in Him instead of himself, and wanted Him to teach Solomon good and evil. And that is the entire point! Having the ability to discern between good and evil is a good thing when we're trusting in God to teach us what exactly good and evil are. But to eat from the tree of the knowledge of good and evil is to do the opposite. It means to trust in yourself to define good and evil. And that's what Adam and Eve wanted; to define good and evil for themselves.
Defining Good and Evil
Wait, but what does that mean? To "define" good and evil for yourself? What am I talking about? When I say Adam and Eve gained the ability to "define" good and evil for themselves, what I mean is they gained the ability to (1) come up with notions of good and evil that deviate from what good and evil truly are(i.e. what God says good and evil are) and (2) believe in and accept said notions.
For example, one might come up with the notion that adultery isn't bad, and then believe in that notion(which might then lead them to commit adultery). And so, that's what the tree gave Adam and Eve; the knowledge to redefine good and evil for themselves; the ability to discern between good and evil on their terms, according to what they believe good and evil are. And that's what it meant for them to become like God. God also has this ability. So, when God said in Genesis 3:22 that humankind had "become like one of Us, knowing good and evil", He meant it.
The difference between us and God, however, is that God's wisdom is to an infinite degree, and consequently, only He has the ability to discern between good and evil perfectly, and any deviation from what He says good and evil are will always be imperfect(and imperfection in a world that's meant to be perfect will always lead to death and destruction), and thus corrupt by definition. Any definition of good and evil that diverges from what God says good and evil are is, by virtue of diverging, counterfeit and corrupt, and will always lead to death and destruction. Why?
Because what good and evil actually are is set in stone by virtue of God having the infinite wisdom to know it; it's ingrained into the very fabric of the universe as fundamental laws of nature that cannot be broken. "But people murder and commit adultery and do all sorts of other sins all the time. Doesn't that mean they're breaking the commandment?" Yes, people do break God's commandments all the time. But the fundamental law isn't that God's commands cannot be broken; it's that His commands cannot be broken without it leading to death, destruction, and/or disaster. If you break God's commandments, something bad will happen, and there's absolutely nothing anyone can do about it(it's like gravity; it's impossible to let go of a cup without it falling to the ground).
And did you notice that is exactly what the serpent lied about? It was actually the only thing he lied about(the serpent said that their eyes would be open and that they would become like God[Genesis 3 verses 7 and 22 confirm that he was telling the truth]). But it was the greatest lie to ever be told(probably an understatement). "If you disregard what God says, you most certainly will not die!" In other words, "Following God's commandments isn't necessary! You can get away with disobeying God and never have to suffer the consequences of doing so; you can define good and evil in a way that deviates from God's definitions, and it won't lead to death or disaster!" How many millions of people who have lived and are living on the face of this planet have convinced themselves of this lie? It's the very lie that Satan told; the lie that has been perpetuated throughout all of human history. No wonder Satan is called the "father of the lie"(John 8:44).
So, eating from the fruit of the tree of the knowledge of good and evil gave Adam and Eve the ability to define good and evil like God, but there was an unexpected side effect. Large-scale corruptibility. Of course, they had the potential to be corrupt before they ate; how else were they deceived by the serpent into eating the fruit(all beings who aren't God and have the free will to define good and evil have a corruptibility potential. That's how Satan, who was once a perfect angel, became evil)? But the corruptibility was at such a diminutive scale before they ate it because, well, they didn't know much! What do I mean?
Before they ate, Adam and Eve could only distinguish between one good thing and one evil thing, because God had only given them one command. To obey His command is to do good, and to disobey His command is to do evil, i.e. to not eat from the tree of the knowledge of good and evil is good, and to eat from it is evil. Therefore, they had a conscience to help them distinguish between good and evil. But that was it. It was an infinitesimally small conscience. As the conscience of a little child(which Adam and Eve were in the eyes of God[cf. Deuteronomy 1:39]), whose knowledge is limited to knowing certain things, i.e. it's bad to lie and good to tell the truth. A little child doesn't know that murder, adultery, torture, rape, etc. are bad(because he doesn't even know what they are), he just knows that if he takes a cookie from the cookie jar it is good to tell his parents that he did so(and bad to tell them that he didn't).
It's the same with Adam and Eve. Their corruptibility(i.e. their ability to be deceived by themselves and by others into thinking that redefinitions of good and evil[that necessarily deviate from God's definitions] are right and won't lead to death) was limited by how much they knew about good and evil, which was hardly anything, thus their potential to be corrupt was small. But at the moment they ate of the tree, at the moment their "eyes were opened," ALL that changed. They knew much more about good and evil now, and having the ability to redefine what good and evil are on such a tremendous scale was way too much for them to handle. It meant having the proclivity to fall prey to their own self-deception(as well as the deception of others) on a scale hitherto undreamt of; they became susceptible to moral corruption(both from sources outside themselves as well as from within themselves) like never before.
And this leads me to my final point. Every day you and I have a chance to eat from the fruit of the tree of the knowledge of good and evil, as well as a chance to have a fear of the LORD(the beginning of knowledge and wisdom). When we choose to do things that we know to go against God's commandments, we are choosing to eat from the tree. And when we choose to refrain from going against God's commandments/choose to abide by and obey God's commandments, we are trusting in God(trusting that He knows better than we do), and thus having a fear of the LORD, which corresponds to NOT eating from the tree of the knowledge of good and evil.
So, in summary. Having the ability to discern between good and evil is very good in the eyes of God when we are abiding by God's definitions of good and evil(the only right ones); it means trusting in Him to teach us what is right and wrong. And the ability to discern between good and evil is bad when we are choosing to abide by our own(or someone else's) definitions of good and evil, ones that deviate from God's definitions. It's bad because we are deceiving ourselves into thinking that they're right, OR that we can get away with disobeying God, both of which are straight-up lies. Adam and Eve wanted the ability to discern between right and wrong on their own terms; they wanted to define for themselves what right and wrong are, just as God can do so. And by eating from the tree of the knowledge of good and evil, they got what they wanted and became like God.
They gained the ability to define good and evil for themselves, which is a nice way of saying that they gained the potential to become tremendously corrupt, a level of potential that they weren't even close to having before they ate. Corrupt because, in reality, any definition of good and evil that diverges from what God says good and evil are is, by virtue of deviating, counterfeit, and will always lead to death and destruction. By defining good and evil for ourselves we completely disregard this fact, and convince ourselves that it isn't true, even though it actually is; hence corruption! And every day you and I are faced with a decision; are we going to define good and evil for ourselves(eat from the tree of the knowledge of good and evil), or are we going to let God define good and evil for us(have a fear of the LORD, the beginning of all knowledge and wisdom)?
So, I hope this helps. Great job if you made it all the way down(you deserve a medal). Have a great day! :)