It is difficult to visualise the question without the pictures, but here goes:
If the solution is as you say, you need to understand Boolean logic to get that each gate returns 1 (true) or 0 (false). In the equation, A OR C is 1 if either A or C or both are 1. NOT(something) inverts 1 to 0 or 0 to 1. B XOR D is 1 if B and D are different and 0 if they are the same digit. AND returns 1 only if both the numbers it joins are 1, and 0 otherwise.
Assuming the 4-digit number is ABCD in binary, with A, B, C and D each being either 0 or 1, then there are sixteen possible numbers as follows.
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
If you use each of these numbers in the solution equation the result is as follows. For example, using 0000 (A=0, B=0, C=0, D=0), then the equations is
NOT ((0 XOR 0) AND NOT (0 OR 0))
=NOT ((0) AND NOT (0))
=NOT ((0) AND (1))
=NOT (0)
=1
For 0001 we have
NOT ((0 XOR 1) AND NOT (0 OR 0))
=NOT ((1) AND NOT (0))
=NOT ((1) AND (1))
=NOT (1)
=0
Applying this logic to all sixteen ABCD numbers, only 0001 and 0100 (=4 in decimal) result in the equation value of 0, with the others all 1.
Now to the figure "2" in the question. I presume the calculator display is a single number made up of 3 horizontal and 4 vertical short lines in a square-cornered figure of 8. If we number those lines 1 to seven, say starting top left and numbering round the edge clockwise and ending with 7 in the middle, then to create a "2" in the calculator display we need the backlight for lines 2, 3, 5, 6, and 7 to be on (1) and 1 and 4 to be off (0). Having an equation like the one shown results in 1 and 4 off and the rest on as required.