The ellipse, the comet position, and the comet velocity all come from the same Keplerian orbit. The Sun is at the left focus, close to the ellipse’s edge. The comet moves fastest at perihelion and slowest at aphelion.
Energy history — kinetic and gravitational potential
K = ½mv²
U = −GMm/r
E = K + U = constant