From John Jeske's wonderful book, Connecting Sinai to Calvary
Because in our place our substitute lived a life of perfect obedience to the holy law of God, God considers us to be people who have given Him the perfect obedience He demands. Because in our place our substitute died innocently under God's curse, God considers us to have been punished for our sin.