I believe it's one of these:
If the player feels like they have enough control over their character to think it possible to BE the character. (like First-Person Free Roam games)
If the player feels a connection to one of the characters they are controlling. (like in Dwarf Fortress)
An example of the first one is Slender. You have control over where you go etc. which makes it scary. But as soon as you get to the fence and hit an invisible wall, it immediately loses the immersion. (but in this case, the immersion builds up again quite quickly)
The second one is a bit more complicated. It helps if you don't have immediate control over the characters, because then they feel like real beings. AI is very important. Dwarf Fortress does this especially well.