WASHINGTON—Rock bands and racial slurs were on stage at the Supreme Court Wednesday, as the justices appeared doubtful the federal government can refuse to register trademarks that disparage others.

The court heard oral arguments in a case about the provocatively named Asian-American rock outfit the Slants, which wants the U.S. Patent and Trademark Office to register a trademark on the band’s name. The PTO rejected the request. An agency panel acknowledged the band meant well in attempting to reclaim a word traditionally used...