He did not ever get elected, but he could be seen as a political leader of one of the major parties of Weimar Germany, and Germans broadly understood that votes for the NSDAP were ultimately, votes for Hitler to eventually be Chancellor.
Weimar Germany had a convoluted governing system in which the directly elected President, through various machinations, could keep Chancellors in office even without a majority support in the Reichstag, albeit in a way that was politically unstable and that limited certain government actions. Near the end of Weimar Germany Franz von Papen had been serving as Chancellor because him and President Hindenburg largely shared extreme conservative politics (this wasn’t the right wing reactionaryism of the Nazis, this was more the industrialist / military / old Prussian nobility wing of German conservatism), and Hindenburg had steadily churned through a series of Chancellors who couldn’t command a working majority in the Reichstag.
Papen was not able to either, but he started courting the Nazis to try and secure a majority for himself–part of that effort was he ended official suppression of the SA (which contributed significantly to the NSDAP’s ability to use violence in subsequent elections.) Papen was unsuccessful in securing the backing of the NSDAP, and eventually was compelled to call new elections, held in July 1932. These elections were the “high water mark” for the Nazis in mostly free/fair elections–they won 37% of the vote. In the coalition political era, it was a pretty impressive total, but still not enough to form a government. The communists also saw significant gains, as Weimar Germany was rapidly drifting towards extremism on both sides of the political spectrum.
While Papen and the Nazis engaged in negotiations, they could never settle on a government. Partly because Hindenburg was extremely opposed to Hitler serving as Chancellor. Papen had to call yet another set of elections, this time in November of 1932. A vote-weary public turned out fewer total votes, and the NSDAP vote share fell to around 33%. While no party had a workable Reichstag majority, the Nazis were clearly the most popular party in the country. This can be seen as a form of election, in a system like Weimar Germany’s in which you aren’t directly electing the Head of Government.
Papen finally resigns in December after the November elections did nothing to solve Germany’s political crisis, replaced by General Kurt von Schleicher, a retired officer who represented a sort of militarist wing of conservatism. Oddly for his background, Schleicher attempted to brand himself as a sort of trade union populist, who would unite all the non-Nazi parties under his banner and run a coalition government, but there was no real trust for him in such a role and he was unable to cobble support together. There is some aborted attempts for the Reichswehr to get involved and implement a military junta, but this is quashed by Hindenburg. Finally, Papen convinces Hindenburg to sack Schleicher and appoint Hitler Chancellor, but in a coalition government where the NSDAP would only control 3 of 11 cabinet seats. This, combined with the fact the NSDAP didn’t have a working majority in the Reichstag without its coalition partners, Papen assured Hindenburg would prevent Hitler from getting out of control.
However, Hitler immediately started using any and all powers of his office to weaken other political parties. Note that at this time, Hindenburg and Hitler’s coalition partners had enough de jure power under the Weimar constitution, they still could have stopped Hitler. They also had enough de facto power because Hindenburg would ultimately command the loyalty of the Reichswehr and without the military Hitler could be fairly easily removed. But this didn’t occur for a number of reasons, many powerbrokers in Germany largely saw the Weimar Republic as a failed idea, and had become skeptical of the value of democratic government. Many of them were highly skeptical of Hitler and disliked much of his political ideology, but they very foolishly believed they held enough strings that they would be able to keep Hitler more or less under their control.
Hitler called new elections in March of 1933 to attempt to shore up legal power, however this is not considered to have been a free / fair election (most historians view the November 1932 election as the last free election in Weimar Germany–however note that the Weimar era of German history was very violent and unstable throughout, so even the “free” elections in the Weimar era featured lots of violence and activities that would broadly be seen as incompatible with free exercise of democracy in modern times.) The quasi-free elections of 1933, in which the SA had free run to terrorize enemies of the NSDAP, and where the full powers of the Government were used as much as Hitler was able to quash opposition, still did not give Hitler an outright majority–and what he was looking for was 66%, the threshold he needed to pass the Enabling Act (which he hoped to achieve in coalition with the conservative DNVP.) The NSDAP won 43.9% of the vote in this election, and the DNVP won 8%, giving their right-wing coalition a small outright majority (340 seats in the Reichstag, with 324 needed for majority) but not enough votes to clear the supermajority threshold for passing the Enabling Act.