It goes without saying that an expression like it goes without saying can drive literally-minded folks nuts. Why, they demand, if something truly goes without saying, would someone say it? Following that same logical train of thought, if there is no need to say something, why do people precede avowedly unnecessary comments with the qualifier needless to say?
Why, indeed. The short answer is that English does not always follow the rules of logic. The longer answer involves an investigation of idioms, expressions peculiar to themselves either grammatically (as in no, it wasn't me) or in having a meaning that cannot be reckoned from the sum of their parts (such as using the phrase had better to introduce a wise course of action).
Idiomatic phrases are not logical. In fact, the word idiom itself has an ancestor in a Latin term meaning individual peculiarity of language. Such peculiarities of language as needless to say and it goes without saying may be considered individual, but they do share two purposes: either one may emphasize that a writer or speaker regards the statement being made as in some way self-evident; and either may provide a graceful transition between sentences or paragraphs.