The far-right party, Alternative for Germany, or AfD, got some 13 percent of the vote — nearly three times the 4.7 percent it received in 2013 — a significant showing of voter anger over immigration and inequality as support for the two main parties sagged from four years ago.