Transitive closure of a directed graph (reachability) algorithm intuition/explanation
What the algorithm is doing is updating all $T[x][y]$.
Assume that $T$ is transitive and that a new edge $(u,v)$ is added. Which pairs $(x,y)$ would need updating? Well, those pairs for which adding $(u,v)$ creates a new path from $x$ to $y$.
Assume that we are in a case that doesn't enter the IF. If it is because $T[x][u]\neq 1$ then there was no path to go from $x$ to $u$. So adding $(u,v)$ will not help getting from $x$ to $y$.
If $T[x][u]=1$ and $T[x][v]=1$, then the new edge $(u,v)$ doesn't really change anything in terms of being able to get from $x$ to $y$.
So, the cases excluded by the IF are cases that don't need updating anyway.
Assume now that you are in a case that does enter the IF. So, $T[x][u]=1$ and $T[x][v]=0$.
If $T[x][y]=1$ we already were able to get from $x$ to $y$ before adding $(u,v)$. The maximum returns $1$. So, the value of $T[x][y]$ is not changed and still is $1$ after the loop exits.
Assume that $T[x][y]=0$. If we consider a $y$ such that $T[v][y]=1$, then that means that we can go from $x$ to $y$ by going from $x$ to $u$, from $u$ to $v$ using the newly added edge, and from $v$ to $y$. Precisely in this case the maximum will also result in $1$. To $T[x][y]$ gets updated to $1$.
Now, if the inned loop lands in a $y$ such that $T[x][y]=0$ and $T[v][y]=0$, that means that we originally were not able to get from $x$ to $y$ by paths not using the edge $(u,v)$. Any path that uses the newly added edge $(u,v)$ would have to go from $x$ to $u$, then $u$ to $v$ and finally some path from $v$ to $y$. This last part of the path can be assumed consisting entirely of edges different from $(u,v)$ by taking the portion starting from the last time that the supposed path leaves $v$. But the assumption $T[v][y]=0$ means that this path doesn't exist. So, there is no way to go from $x$ to $y$, and in fact the maximum in the code results in $0$ in this case.
So, that covers all the cases.