When the comet is closest to the Sun,
it has its maximum kinetic energy
and minimum gravitational potential energy. When the comet is far away from the Sun, it has maximum gravitational potential energy and minimal kinetic energy. It's faster when it's close because the Sun's gravity is pulling the comet closer. The opposite for when it gets farther away