I think it's because in general, "det" is used to mean "it" or "that" regardless of whether it is an "en" or "ett" word.
However, when an adjective is used before "the object", it is necessary to precede it with "det" or "den".
e.g. Det rött äpplet (the red apple) Den bra boken (the good book)
In this specific example though, it is talking about a good book, rather than the good book, which is why the "det" here just means "it" (I think)