SAN FRANCISCO—Democratic lawmakers in some cities and states are setting aside millions of dollars to pay legal fees for immigrants who face deportation under the Trump administration.

Mayors in Los Angeles, Chicago and San Francisco have said they would establish special funds to provide attorneys for immigrants facing the threat of deportation. Critics say such measures are an inappropriate use of taxpayer dollars.

The...