Your question goes to the heart of Salvation, and surprisingly you are not alone in not understanding how our sins can be transferred to Jesus and thus be forgiven.
So lets see if we can clear it up for you.
All Scripture is quoted from the King James translation, unless otherwise noted.
First of all we need to start with one basic fact, that being that Jesus is the only Human who ever lived on the Earth and did not sin. So what does that really mean? Jesus never had so much as a bad thought, and he fulfilled not only the law, but the intent of the law.
So what does it mean that he fulfilled not only the law, but the intent of the law? We have to go back to the Old Testament to begin our explanation. The first requirement is that we are to be as Holy as God is:
Leviticus 11:45 For I am the LORD that bringeth you up out of the land of Egypt, to be your God: ye shall therefore be holy, for I am holy.
To start with God knew before he created the Earth that we would be unable to be Holy as God is holy.
So if God knew we could not do what he required us to do why did he charge us with even trying to be? God Created the Universe and everything within it as a part of his overall plan, and even though we do not know what that overall plan is we know that we are a vital part of it, otherwise God would not have sent his son to bring us salvation.
The requirement to be Holy is necessary if we are to be acceptable to go to Heaven, but we are not able to accomplish that by ourselves, and so God had to provide an alternate path for us to attain acceptability for Heaven.
So lets see if we can determine just how that works, and so lets begin in the book of Leviticus.
Leviticus 26:3 If ye walk in my statutes, and keep my commandments, and do them;
This is a conditional promise, but it was broken almost immediately by the Israelites.
But God in his infinite mercy gave them a foretaste of Salvation.
Leviticus 1:3 through 5 If his offering be a burnt sacrifice of the herd, let him offer a male without blemish: he shall offer it of his own voluntary will at the door of the tabernacle of the congregation before the LORD. And he shall put his hand upon the head of the burnt offering; and it shall be accepted for him to make atonement for him. And he shall kill the bullock before the LORD: and the priests, Aaron's sons, shall bring the blood, and sprinkle the blood round about upon the altar that is by the door of the tabernacle of the congregation.
There are three important thing that must be noted here;
It had to be without blemish, and this requirement is for anything given to God.
If the sacrifice met God's standards it would then be an acceptable atonement.
The blood was to be sprinkled on the Altar. This is the most important part. Why is the blood so important? Because the blood is life and no human can live without it; it keeps all parts of the body alive by delivering life giving oxygen to all the cells of the body.
By sprinkling the blood on the Altar it was representative of giving back to God the life he had given man, that changed him from dust to a living soul.
Genesis 2:7 And the LORD God formed man of the dust of the ground, and breathed into his nostrils the breath of life; and man became a living soul.
When Jesus died on the Cross it was the same thing as sprinkling the blood on the Altar, or in other words, Jesus was giving back the life that was breathed into man. But what life was he giving back since he had never sinned.
That is why Salvation is such a marvelous thing. Just as the unblemished animal sacrifice was acceptable as a substitute, so Jesus was a unblemished and acceptable substitute for us. And when we ask Jesus to be the propitiation for our sins and ask God to forgive us, then Jesus sinless blood sprinkled on the Altar of God gives our now unblemished life which God breathed into us and we became a living soul, back to God.
Why is that important? It's importance lies in the requirement that man must die in return for his disobedience.
Genesis 2:16 and 17 And the LORD God commanded the man, saying, Of every tree of the garden thou mayest freely eat: But of the tree of the knowledge of good and evil, thou shalt not eat of it: for in the day that thou eatest thereof thou shalt surely die.
The penalty of death was not for gaining the Knowledge of good and evil it was for eating from the tree which God forbad Adam to eat, or in other words disobeying God.
Hope this clears it up for you.