It is because Jesus paid the full price for our redemption and took on Himself the full penalty for our failure to keep the law of God. Because the price has been paid, and the penalty received, we are able to obtain salvation as a free gift with the condition that we put our whole faith and trust in Jesus Christ, who died and shed His blood on the cross to pay that price and receive the penalty.
It is like getting to the supermarket checkout with a trolley full of groceries to find that someone else has paid for them, so you don't have to pay, and so you receive your trolley full of groceries as a free gift from the person who paid the bill for you.