The experience Mr. Buttigieg gained as a mayor is a central part of his pitch as a presidential candidate, but it has also recently become a bull’s-eye for some of his rivals, who are trying to undercut his momentum in the race by sowing doubts about whether he is prepared for the Oval Office. On Tuesday, Mr. Buttigieg finished a strong second in the New Hampshire primary and a week earlier he made history as the first candidate to prevail in the Iowa caucuses whose highest elected position was mayor. In both states he beat a former vice president and several other veteran politicians, in large part with a message about what he learned as the son of a struggling Midwestern city who was determined to turn it around.

But his record has also been challenged by some city residents and activists, particularly on problems facing black residents, and he has had some of his toughest moments in the race trying to explain his record on policing. In a debate in New Hampshire last week, he was pressed about an increase of arrests of black people for marijuana possession during his years in office, which he struggled to explain as a collateral effect of a crackdown on violent crime.

Former Vice President Joseph R. Biden Jr., fighting for the same center-left voters as Mr. Buttigieg, released a digital ad ahead of New Hampshire voting openly mocking Mr. Buttigieg’s qualifications. Senator Amy Klobuchar of Minnesota compared him in the debate to President Trump: “We got a newcomer in the White House and look where it got us,” she said.

If elected, Mr. Buttigieg will be 39 on Inauguration Day, the youngest American leader in history. He is well aware that, if he continues to notch victories after Iowa, there will be voters wondering if a millennial who was mayor of Indiana’s fourth-largest city is truly qualified for the presidency.

A close look at some key episodes for Mr. Buttigieg shed light on how he governed, struggled and grew over his eight years in office, in particular in responding to people’s needs and frustrations. The Harvard-educated, former McKinsey consultant came into office with a technocratic approach to leadership, and some of his actions are revealing about challenges he faces today — particularly his low support among African-Americans nationally and the perception that he is most at home with his fellow elites.