Ambition began as a walk. In Latin, ambitio literally meant "a going around."
The verb behind it is ambire, made from amb-, "around," and ire, "to go." Merriam-Webster lists its senses as "to encircle, visit in rotation, solicit (political support), seek to obtain." The political sense is the key one. In ancient Rome, candidates spent much of their time going around the city asking citizens for their votes, and ambitio was the word for that effort.
Canvassing was not always clean. The hosts of the Endless Knot podcast note that it could involve flattery and bribery, and that laws were passed to control it. Because the rounds were driven by a desire for honor or power, Merriam-Webster explains, ambitio came to mean that desire itself.
That is the sense English borrowed in the 14th century, through French. It was not a compliment. Ambition first meant something like greed for success. In the 15th century Reginald Pecock listed "pride, ambition, and vainglory" together among the vices. In the 16th, Thomas Nashe called it "any puft up greedy humour of honour or preferment." Milton's Satan falls through "pride and worse ambition."
The older, literal sense also survived for a while. Wiktionary records an obsolete meaning, "the act of going about to solicit or obtain an office," cited from Milton's Samson Agonistes in 1671.
The approving sense came later. Merriam-Webster traces the shift from a desire for honor or power to "an admirable desire for advancement or improvement," and later to the object of that desire, the goal itself.
Roman campaigning gave English another word too. A Roman office seeker wore a toga whitened with chalk, and candidatus meant "dressed in a white toga." English took it as candidate in the 17th century. So a candidate with ambition is, by origin, a man in a bright white toga making his rounds of the city.