RIO DE JANEIRO—Wealthy Brazilians are fleeing the country, terrified by spiraling gun violence and pessimistic about the nation’s political and economic future.

Thiago Lacerda, a top soap opera star, is one of scores of celebrities, bankers and other wealthy Brazilians considering emigration as a last resort.

“I’m totally freaked out by what’s...