Hello! I'm Brazilian, I think I can explain it to you.
First you have to understand something: ( nessa = em + essa ) and ( naquela = em + aquela ). In English would be something like ( nessa = in + this ) and ( naquela = in + that ). "This" and "That" differ in proximity, right? What is close you say "this". What is far you say "that".
In Portuguese it's the same. Nessa ( in + this) you use to point something that is close to you (Eu vivo NESSA casa - I live in THIS house - You are in the house or close to the house) and Naquela (in + aquela) you use to point out something that is far from you (Eu vivo NAQUELA casa - I live in THAT house - you are far from the house and you are pointing that out to a friend).
About the version NESSE and NAQUELE, they follow the same rule, the difference is the gender. They are used for masculine words. NESSA and NAQUELA are used for feminine words.
I hope I have helped! :***
The basic rules for "isto", "isso", "aquilo", "este", "esse" and "aquele" (and all their combinations with prepositions)
Looks like the program works with specific Portuguese-to-English word/sentence pairs (like Anki custom flash cards) which can be used at random as translation or listen-and-transcribe tasks. This approach has limitations such as you noted, which is where this handy question discussion feature becomes handy. The mods/programmers do seem to address the glaring issues that arise if you directly report them though.