God did this because our first parents, Adam and Eve, sinned thereby bringing death and misery into the world. Therefore each of us is born a sinner, is separated from God, and does not know Him personally.
Sin has consequences.
All the things we do that are evil in God's eyes, such as lying, cheating, hating, killing, lusting, and all the things we don't do that are pleasing to God, such as loving our enemies, worshiping Him, confessing our sins, and trusting His Son, are counted against us making us liable for the judgment of God. One day God will judge the whole world. All who ever lived will be raised from the dead and brought before the Great Judgment throne of God. In His great wisdom God the Father planned to send His Son to take the place of sinners by dying on a Roman cross for them. On that cross God poured out upon His Son the wrath and judgment that we deserved.