https://youtu.be/zrz-obSpK6Y?si=x5O3obzhsOklwGD7 God created the apple to provide Adam and Eve with freewill by allowing them to choose obedience to God or disobedience which is supposed to prove their love and loyalty. The fruit was not evil, rather the act of disobedience was a spiritual damage that revealed the reality of evil to them and led to humanity Fall.
God's intention was to give Adam and Eve the freedom to choose their path either to love and obey him from their heart not being like programmed robot. God used it to test their trust and love for him which is necessary for any genuine relationship. The name of the tree was the tree of knowledge of good and evil, because after eating the fruit, it opened their eyes to the concept of both good and evil, leading them to a deeper understanding of God's will.
The act of eating the fruit was an act of disobedience that cause them spiritual death and also separated them from God. It brought shame, a desire to hide from God, a life of suffering and death for human kind. The creation of the tree was not a cruelty but an opportunity for Adam and Eve to demonstrate their commitment to God and receive their blessing.