The issue started in Houston when city council passed HERO (Houston Equal Rights Ordinance). HERO added LGBT to a protected class that cannot be discriminated against for employment, services, housing, etc. It also included protections for trans persons to use public restrooms that matched their identity. There was massive opposition to this ordinance. Mostly the opposition argument was businesses were afraid they would be forced to bake "gay" cake(and all the marriage, wedding halls etc). Conservatives in Texas are very upset that they are being expected treat LGBT with any dignity and want to protect their ability to discriminate legally.
So, the ordinance was put to a ballot. They couldn't gain traction by saying LGBT shouldn't be protected, so they ran television and radio ads showing predators in bathrooms. Most people voting didn't even know the ordinance included veteran status, age, weight, sex, race. They only knew it as the bathroom law. The vote happen and the ordinance was defeated. But the Houston anti-trans bathroom movement had been born. Texan politicians love to use deception, fear and anger(and religion) to manipulate their voters. Now that Texas politicians found a winner for fundraising and support, they're milking it for all they can. They don't care about the lives of those affected as long as they get their voters and donations. I've never seen such corrupt politics till i moved here.
The supporters of the law did a horrible job of defending it and countering the fictitious arguments. At the same time, money was flowing into the HERO opposition groups.