For the body to escape Earth's gravitation and reach infinity, the initial kinetic energy has to be just higher than the Gravitational potential energy of the body on the surface.
Total energy of the body just after projecting is:
E=12mv2−GMmRe
Now this total energy has to be just greater than zero, so the minimum speed is achieved when kinetic energy is equal to gravitational potential energy.
⇒12mv2=GMmRe