The Great Wall is not one continuous structure. Different dynasties built different walls, sometimes hundreds of kilometers apart. The Qin, Han, Jin, and Ming walls all followed different lines, and much of what survives today is Ming work with older rammed-earth sections underneath or nearby.
For the Ming line, the popular eastern endpoint is Shanhaiguan, but Ming defenses continued into Liaoning, and the strict easternmost point is often identified as Hushan near Dandong on the Yalu River. Shanhaiguan remains the iconic eastern pass and the one tied to the 'First Pass Under Heaven' name.
In the west, the Han dynasty pushed past Jiayuguan. Han-era walls and outposts ran toward Yumen Pass and Yangguan near Dunhuang, with frontier lines extending farther into what is now Xinjiang. Jiayuguan is therefore the western end of the Ming wall, not the westernmost wall China ever built.
So the honest answer is: Shanhaiguan to Jiayuguan for the Ming Great Wall most visitors mean; a longer, more fragmented story if you count every dynasty. Gansu is where that longer story is easiest to see.