When a planet is at perihelion, why does its orbit speed up, but not directly towards the Sun?
At perihelion the planet's velocity is at its maximum, it doesn't speed up AT that point. Please see below.
Let's loot at a picture of the Earth's orbit:
What actually happens is that at aphelion (the furthest point away from the Sun), the Earth is at its slowest. From there all the way to perihelion, it speeds up. AT perihelion it is at its fastest and from there on up to aphelion it slows down.
Now, if the Earth was just a stationary object placed somewhere in the Sun's area of gravitational effect, it would just fall in accelerating all the way until it hit the Sun, however, the Earth has a "sideway" movement as well, which places it in an orbit. That movement plus the curved space created by gravity is what creates the orbit.