An unhappy and unsettled electorate is giving a lift to antiestablishment candidates and changing the dynamics of the 2016 presidential contest for both parties, a new Wall Street Journal/NBC News poll finds.

Amid a rise in Americans saying the country is on the wrong track, Donald Trump has moved to the top of the Republican field while liberal long-shot Bernie Sanders has gained ground among Democrats.

But...