In the older Pokémon games my brother and I always tried to come up with the most weird Pokémon-names. For example we chose something like "poo-toilet". Will others be able to see them and can you get in trouble if you pick a name that offends others? Can other people see the name if your Pokémon is in a gym?
Other trainers cannot see nicknames you give Pokemon, so nobody else will be able to tell if you give your Pokemon offensive names.
Source: "...create a personal nickname that can only be seen by you" (emphasis mine)
They do seem to filter out some things, I couldn't put some names I wanted in there.