Ge 2:16 And the LORD God commanded the man, saying, "Of every tree of the garden you may freely eat;
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."
Verses 9,16 and 17
Moral and spiritual development was good for man. His will must be exercised towards God. God wants a loving relationship, and a genuiene love relationship must come from man willingly and voluntarily obeying God. And so God tested him here.
There was nothing intrinsically and inherently bad in the fruit itself. It was independence from God, disobedience to God's command, that brought death.
Sin is basically independence from God. And when we do that, we separate ourselves from Him, the source of life, and the result would be death. The very moment man disobeyed God, spiritual separation (death) resulted. Man spiritually cut himself off from the source of life. His physical death was the result of his spiritual separation from God.
Here Moses was emphasizing to his Israelite readers that obedience results in blessing but disobedience results in punishment and death.
This was to encourage and exhort the Israelites to keep the covenant that they made with God.