Why did Jesus come to earth?
There are numerous answers to this question.
The most important answer is that Jesus came to "seek and save that which was lost" (Luke 19:10).
From the Fall in the Garden (see Gen. 3), humanity was separated from GOD. Since that day, everyone has sinned and falls short of GOD's glory (Rom. 3:23).
Sin creates a debt that the sinner cannot pay. The reward for sin is death (see Rom. 6:23). On account of our own deeds, we stand convicted of sin and under the sentence of spiritual death, the punishment for which is eternity in hell (see Rev. 21:8).
Thankfully, GOD loves us so much that He was unwilling to sit back and allow all of His creatures to rush head-long into the lake of fire and brimstone.
His great love motivated Him to devise a plan, before the world was created, as to how He would save us.
That answer, of course, is Jesus.
As the apostle John wrote:
16 For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life. 17 For God did not send his Son into the world to condemn the world, but to save the world through him.18 Whoever believes in him is not condemned, but whoever does not believe stands condemned already because they have not believed in the name of God’s one and only Son...36 Whoever believes in the Son has eternal life, but whoever rejects the Son will not see life, for God’s wrath remains on them.
(John 3:16-18, 36 NIV)
Jesus lived a sinless life which qualified His blood as a worthy substitute (sacrifice) for our guilty blood.
GOD told Moses that the life of a creature is in its blood and that it is the blood that makes atonement (or covers the guilt of) one's life (see Lev. 17:11, 14).
By GOD's plan, Jesus gave His life upon the cross of Calvary in order to pay your and my debt of sin to GOD.
Because of this, Jesus now offers the one and only way for us to come to the Father.
For His sacrifice and accomplishment, GOD has given Jesus the highest honor:
9 Therefore God also has highly exalted Him and given Him the name which is above every name,10 that at the name of Jesus every knee should bow, of those in heaven, and of those on earth, and of those under the earth,11 and that every tongue should confess that Jesus Christ is Lord, to the glory of God the Father.
(Phil. 2:9-11 NKJV)
Although Jesus provides the bridge between us and the Father, GOD did not choose to universally apply Jesus' blood to every man's sins.
Why didn't GOD just save everybody?
This is a most critical question to understand.
GOD is looking for people who are looking for Him (see John 4:22-24). What He wants is for people to become like Him in their character—to repent of their sinful ways and live holy lives (see 2 Pet. 3:9; 1 Pet. 1:13-16).
To learn what the Bible really says that a person must do to be saved, read: Life's Most Important Question. Beware that there is much confusion and misinformation spread about the subject of salvation. Don't be deceived. See what the Bible really teaches and what the early Christians practiced.