Bathroom Etiquette: Why We Shouldn't Mention Allah's Name?
As Muslims, it's a must to keep proper manners in every activity, including when we're in the bathroom. One of the recommended etiquettes is not to utter the name of Allah SWT. This is to preserve the honor and purity of His name, considering the bathroom is pretty much associated with impurity and filth.
Most scholars say that mentioning Allah's name in the toilet is makruh (disliked). Imam An-Nawawi explained that talking or doing dhikr while relieving oneself is makruh unless it's really necessary. If you sneeze, it's recommended to say 'Alhamdulillah' in your heart without moving your tongue.
Some hadiths back this up, like a narration from Abu Dawud that the Prophet SAW used to take off his ring that had 'Muhammad Rasulullah' engraved on it before going to the bathroom. In a hadith from Muslim, he didn't answer a greeting while he was urinating, and only replied after he had cleansed himself, saying, 'I dislike mentioning the name of Allah unless I am in a state of purity.'
https://mozaik.inilah.com/dakw