If it is the only subject of the sentece it is "it": "Det er ikke godt." is "It is not good." If it precedes a adjective + et-noun, then it is "the". "Det grønt æble er ikke godt.", which means "The green apple is not good.". And then there is this sentence case, where it is det + noun, which means "that". Or at least this is what I understood until now, hope it helps!