This is analogous to the dynamic programming solution to $0/1$ knapsack problem.
Consider the capacity of the knapsack, i.e., $W$ to be analogous to $J$(the total sum here).
The solution exploits the optimal substructure of the problem.
At each stage we can have $2$ options:
Case $(1)$: Either we take an item(in this question either we consider the element $A_i$) along with the total solution to previous sub-problem(total solution here means the total sum obtained till previous sub-problem)
in which case we choose $A[i-1]$$\left [ j-a_{i} \right ]$
$A[i-1]$ indicates we are considering solution to previous subproblem and
$A[j-a_i]$ means we have considered element $a_i$ and now remaining sum is $J-a_i$ which has to be further considered.
Case $(2)$: Or we do not consider the item(in this case the element $a_{i}$) in which case we only consider the solution to previous subproblem, which is, $A[i-1][J]$
Since the whole solution to this subset-sum problem is Logical OR(+) of cases 1 and 2, we eliminate options $C$ and $D$ because both are considering the Logical AND of the two parts of the solution.
Now, since here in the given question we are given a boolean array $X[n][W+1]$
So, an entry $X[i][j]$ is true only if sum $j$ is possible with array elements from $0$ to $i$.
So, for Each element of array, $a_{i}$, we consider two possibilities:
(1) Either we can ignore it and still get our possible sum, which is, $X[i-1][j]$
OR
(2) We could include element $a_i$ and then get our required sum, which is, $X[i-1][j-a_i]$
And finally, to get $X[i][j]$, we take logical or of the above two cases.
Hence, answer is option B.
Reference :
By using the analogy of the problem and solution between subset-sum problem and $0/1$ knapsack problem, the above video clearly explains the how the solution to the problem is structured .