Because He wanted to be in relationship with us.
God is a generous and loving God. He created everything perfect but He knew we would fail. But because He wanted us to freely love Him, He gave us free will – i.e a relationship, rather than living as robots. He already worked out how to save us even before we fell… But we don’t know right from wrong apart from the law. So He sent Jesus to show us His example for righteous living.