In Prolog, not is implemented as "negation as failure". not(X) succeeds if X fails, and fails if X succeeds. not doesn't mean "logical not" in the classical sense.
And it's considered deprecated due to such confusion and should not be used in a new code according to the SWI prolog. https://www.swi-prolog.org/pldoc/man?predicate=not/1