Hillary Clinton and Senator Bernie Sanders of Vermont clashed in heated terms over the meaning of progressivism in America on Wednesday, with her forced to defend positions that he argued are not in line with the liberal wing of the Democratic Party.

Mr. Sanders criticized Mrs. Clinton’s credentials as a progressive, claiming that her views on foreign policy, trade, the environment and money in politics separated her from those lawmakers who proudly wear that label.

At a town hall forum hosted by CNN less than a week before New Hampshire holds the first primary election of the 2016 presidential race, Mr. Sanders suggested that Mrs. Clinton’s positions sometimes shifted depending on her venue.

“You can’t say you’re a moderate on one day and be a progressive on another day,” he said, noting that Mrs. Clinton described herself as a moderate last year. “You can’t be a moderate and a progressive. They’re different.”