Why do perihelion and aphelion occur?
Because of elliptical orbit.
Because the orbit of Earth around the Sun is not a perfect circle, it is almost a perfect circle but yet it is an ellipse with an eccentricity of 0.017. A circle is also an ellipse with 0 eccentricity. Now because the Earth's orbit is an ellipse, the Sun will not be exactly at the center. According to Johannes Kepler, the orbits of all planets in the Solar system are ellipses with Sun at one of the focii. Due to this Earth will be at times closer to the Sun than at other times. When the planet is closest to the Sun it is at Perihelion and when it is further away it is at Aphelion.
The Perihelion of Earth is about 146 million km while the Aphelion is at 152 million km with average distance of 152 million km, also called the semi-major axis.