The sun is not the center of the solar system. The center of our solar system is a point in space called the barycenter. The barycenter is very close to the sun, so calling the sun the center of the solar system is a reasonable approximation. But if you are going to do exact calculations, you have to use the barycenter as the real center of the solar system, and not the sun. Often, the barycenter is not even located within the extended volume of the sun. Newton’s third law states that to every action there is a reaction. To every force there is an equal and opposite force. If you push on a wall, it is pushing back on you at the same time. The sun’s gravity pulls on the earth, and the earth pulls back on the sun at the same time. This is why the center of the solar system is not the center of the sun.
Imagine we had two planets of the exact same mass in outer space with no other planets or stars close enough to have any effect. Planet A’s gravity pulls on planet B with force F. The reaction force is always equal and opposite. This means that planet B pulls back on planet A with force F. Force leads to acceleration according to Netwon’s second law, F = ma. Because the masses of the two planets are equal, and their forces are equal, their accelerations must also be equal. They end up moving with the same speed. This is only possible if they are both orbiting the midpoint between them, as shown in the top animation to the right. The center of rotation is marked with a red dot and is the center of mass of the two planets combined. Because they both have the same mass, the center of mass is just the halfway point. In the context of astronomical orbits, we call the center of mass of a system the “barycenter”.
Now imagine that we take our two planets and give planet B slightly more mass. The forces will still be equal and opposite, but F = ma tells us that with a larger mass, planet B must have a smaller acceleration in order to keep the force constant. As a result, planet B moves less than planet A. This means that planet B has shifted towards the center of rotation, as shown in the middle animation to the right. As we increase the mass of planet B, it circles closer and closer to the center of rotation, as shown in the bottom animation. Planet B would have to have an infinite mass in order for the center of this system to be located at the center of planet B.
Our sun is much more massive than the earth. As a result, the center of rotation of the sun-earth system is very close to the sun. But the center is not exactly at the sun because the sun does not have infinite mass. In addition, there are more planets tugging on the sun than just the earth. All eight planets, and all the moons and asteroids in our solar system are also pulling on the sun. As a result, the motion of the sun relative to the center of the solar system is more complicated than shown in the animations on the right. But the same general ideas still apply. The pull of all the planets as they move in different orbits causes the sun’s motion to slowly shift relative to the center of the solar system, in addition to its circling motion. The image below shows the location of the center of the solar system over the years relative to the sun. The solar system center is sometimes located in the sun and sometimes out of the sun but is never exactly at the sun’s center.
Returning to the original question, people have historically thought the earth is the center of the solar system because that is what it felt like to them. The motion of the earth in its orbit is so close to a constant speed in a straight line that we can’t feel this motion. Without an understanding of physics and detailed astronomical observations, it looks and feels like the earth is not moving and the objects in the sky are moving.