Because the light leaves the torch as a cone of spreading rays, not as a parallel beam.
Every ray that grazes the edge of the object carries on and lands further out on the wall. The closer the torch is to the object, the more steeply those edge rays are spreading, and the further out they land — so the shadow is bigger. Pull the torch back and the rays reaching the object are much more nearly parallel, so the outline they carve out on the wall is much closer to the object’s true outline.
Why the Sun makes a perfect projection: the Sun is about 15 crore km away. By the time its rays reach us they are, for all practical purposes, parallel. So when sunlight falls perpendicular to a wall, the shadow it casts is the projection — same size, same shape. That is why the book says you can settle the question about the parallelogram by taking a cardboard cutout outside and looking at its shadow.
Did you know? This is also why your shadow at noon is short and sharp but long and fuzzy near sunset, and why the shadow of a hand held near a wall is crisp while one held near the torch is huge and blurred.