God created us as spirits before this life.
We started life as spirit children of God, complete with a bodies of spirit.
We were like our Heavenly Father, God, but his body was of flesh and bone.
He is the father of our spirit bodies.
He knew, that with bodies of spirit, that there were things we could not experience and could not ever know and could not ever learn.
Because of His love for us, he gave us a choice to come to this life and obtain a physical body. With that physical body we would be able to experience pleasure and pain, happiness and sadness, sickness and health. Everything we couldn't do as spirits.
Part of our coming to earth was the ability to choose right from wrong. That was part of Heavenly Father's plan for us. He wanted us to be able to choose to follow him or to follow a different way. Because he loves us so much, He gave us this freedom to choose.
He knew that some would follow Him and some would choose to follow Satan.
He knew that if we did wrong that we would need a way to be forgiven of those wrongs.
In our life before this earth life, Jesus Christ, our brother, offered to pay the price for the sins of those who would repent. For those who would not repent, they would have to pay for their own sins.
God loved us so much he gave us a chance to prove ourselves and return to live with Him again.
He loved us so he sent his firstborn son to help us return.