Since you have not accepted Rob's answer let's try a simpler version of it.
The short answer is Conservation of Energy.
The universe below is Newtonian. So, not quite exact but very close except in extreme cases.
First, a simple thought experiment. Go to the Moon or some other quite large and airless body. Take a rock and measure its mass e.g. 1kg. Throw it directly upwards. Measure the height at which you let go and its velocity at that time. We will use the height of release as the baseline for potential energy so the rock starts with zero potential energy. You can calculate the initial kinetic energy from the mass and release velocity. As the rock ascends, it will gain potential energy from its increasing height but lose kinetic energy as it slows. Since the body is airless, no energy is lost due to friction etc. The total of potential and kinetic energy will be constant. Since I said that the body that you are on is large, I will assume that the rock is released below escape velocity. So, eventually it will stop and begin to fall. It will begin to lose potential energy and gain kinetic energy. Since no energy is lost to friction, when it gets back down to the release height, its potential energy is will be zero again and its kinetic energy will be as when it started. So, it will come down as fast as it went up.
Now head out into deep space to a point where the Sun's gravity is negligible. Clear away the Earth, the other planets, asteroids and other junk. So, there is just you, a handy small rock, and the Sun. Throw the rock towards the Sun but not quite on a a collision course. Use its initial distance from the Sun as the zero point for potential energy. So, it starts with no potential energy and a small kinetic energy. As it approaches the Sun, it will lose potential energy (so it goes negative, it can because the zero point is arbitrary) and gain kinetic energy. If your aim was good then it will pass close to the Sun but not so close that it hits it or encounters any substantial drag from solar wind, etc. It will curve around the Sun due to the Sun's gravity but eventually start heading away again. As it heads away, it will start to gain potential energy (less negative) and lose kinetic energy. Since no energy is being lost to drag, it will eventually reach its initial distance from the Sun (where the Sun's gravity is negligible) but be heading away. Its kinetic energy will be the same as you gave it at the beginning of the experiment so it will escape.