What if the question was about a sample of just one item? Then the probability would be (6000-170)/6000, or 1 - 170/6000 that we get a non-defective sample item, and therefore 0.9716... . This is called a Bernoulli trial. We will accept the entire batch with probability approximately 0.97.
Now, first we consider a series of Bernoulli trials. This is if we had REPLACEMENT (in this problem we don't). A coin toss is another example of a Bernoulli trial, with probability 1/2 instead of .97. The probability of getting two heads is 1/2 x 1/2 = 1/4, three heads 1/2 x 1/2 x 1/2 = 1/8, etc. Similarly here, the probability of getting five non-defective items in a row is 0.9716665, that is, the probability of getting one then raised to the fifth power. This is equal to
(1-170/6000)5 = 0.8661...
Going back to the first paragraph, if we draw a non-defective item, and DON'T REPLACE IT, there are now 5999 total and 170 defective. The Bernoulli trial the second time around is (1 - 170/5999) etc.
Without replacement, the problem becomes (1 - 170/6000) x (1 - 170/5999) x (1 - 170/5998) x (1 - 170/5997) x (1 - 170/5996). Just like in the case with replacement, we are multiplying to get the probability of two statistically independent events happening. I hope that helps.