In short, it is the earth that rotates and not the sun. The earth rotates from west to east, and then people standing on earth will see the sun rotates from east to west.
The position of the sun in our solar system is at the center. It neither rises nor sets. But because of the rotation of the earth around its axis, it seems to be rotating. Every 24 hours, the earth makes one complete turn. It faces the east. As the earth revolves, different points on the earth's surface pass through the sunlight. There is an animation on what this looks like every hour for about four hours. As your region turns facing the sun, as it enters the sun's light, it appears the sun rises in the east. When your region starts leaving the sun's light and enters darkness, it seems the sun sets in the west.
Watch the video animation here: