American children learn the difference between acceptable slang and rude slang by getting chastised (or worse! ) by Mom when they utter something rude. Usually American children learn slang both by watching TV and also overhearing the conversations of the "older" and more worldly kids on the playground. If little Johnny says "son of a gun!" at the dinner table his parents will probably laugh, but if he says "son of a bitch!" they will no doubt react in horror and ask him "Where on Earth did you learn such language?!"
You can learn a lot of AmE slang by watching US-produced TV shows and films. In the US, every TV show and cinema film is assigned a "rating" which indicates whether the show contains profane language, excessive violence, or nudity. If your country doesn't use a similar rating system, you might want to look up the program/film you've just watched on the IMDb, which will give a very detailed breakdown of any objectionable language or nude scenes included in the show. If you hear an AmE slang phrase and are unsure whether or not it is rude, you can always look it up in an online dictionary - phrases that are considered rude or vulgar will be marked as such.
Student or Learner