In Prolog, = is the unification operator, not an equality comparison operator like in other programming languages.
When you write cat = cat, Prolog tries to unify the term cat with the term cat, and since they are identical terms, the unification succeeds and returns true.
However, when you write cat = Dog, Prolog tries to unify the term cat with the term Dog, which fails because they are different terms. Therefore, the unification fails and returns false.
Note that in Prolog, uppercase letters are treated as variables unless they are atoms (i.e. they begin with a lowercase letter or a symbol). So, in the case of Dog, Prolog treats it as a variable, not an atom. If you want to use Dog as an atom, you should write it as 'Dog' (enclosed in single quotes).