Mr. Trump has portrayed the issue as one of states’ rights, and already the country’s transgender students face differing realities depending on their school. Some are restricted to the bathroom of the gender on their birth certificate. Others are not. Then there are the students like Mr. Grimm, who have had separate facilities set aside for them.

At issue in Mr. Grimm’s case is whether Title IX, a provision in a 1972 law that bans discrimination “on the basis of sex” in schools that receive federal money, also bans discrimination based on gender identity. President Barack Obama concluded that it did. Despite Mr. Trump’s action, lawyers for both Mr. Grimm and the school board said Thursday that they expected the case to go forward, with oral arguments set for March 28 and school officials across the country awaiting the result.

“No one was in a rush to bring this case to the Supreme Court,” said Joshua Block, a lawyer with the American Civil Liberties Union, which represents Mr. Grimm. “Gavin didn’t choose this fight; this fight happened to Gavin. But now that we are here, lives are at stake, and they are at stake in a way that is even more acute because you don’t have a federal government anymore to protect us.”

For Mr. Grimm, who said he knew he was a boy “as soon as I was aware of the difference between boys and girls,” the case amounts to a crash course in government and media relations. It bears his initials, G.G., because he is a minor, and the name of his mother, Deirdre.

At home in rural Gloucester, he is a kid with a pet pig named Esmeralda, a geek’s love of Pokémon cards and 600-plus Facebook friends. He wears $12 sneakers from Walmart and likes eating at Fuddruckers because the name sounds funny. He is applying for college, but doesn’t want to talk about it.