I am trying to check why curvature 0 implies that the horizontal distribution is involutive.
Let $\pi:P\to U$ be a principal $G:=GL_n$ bundle. Assume that $P$ is trivial and $\pi$ admits a section. Thus, $P\cong U\times G$. A connection on $P$ is a $G$ equivariant splitting of the short exact sequence of bundles $0\to P\times\mathfrak{g} \to TU\oplus TG\to \pi^*TU\to 0$. Let us denote this splitting by $s$. If $(v,u)$ is a tangent vector at the point $(x,g)$, then $s(v,u)=w_x(v)+(R_{g^{-1}})_*(u)$, where $w\in\Gamma(X,\Omega_U\otimes\mathfrak{g})$.
Let $x_1,x_2,...x_n$ be coordinates on $U$ and consider vector fields $X_i$ corresponding to them. Use these to construct horizontal $G$ invariant vector fields on $P$ which are given by $((X_i)_x, -w_x((X_i)_x))$ at the point $(x,Id)$. This should give an involutive distribution on $P$.
Using that $[X_1,X_2]=0$, when we compute the Lie bracket, we get $[(X_1,-w(X_1)),(X_2,-w(X_2))]=-[w(X_1),X_2]-[X_1,w(X_2)]+[w(X_1),w(X_2)]$. =$X_2(w(X_1))-X_1(w(X_2))+[w(x_1),w(X_2)]$. We need to show that this is 0.
The condition that curvature is 0 is given by $dw+w\wedge w=0$, i.e. $dw_{ij}+\sum_{k=0}^{n}w_{ik}\wedge w_{kj}=0$. This means that $dw(X_1,X_2)+[w(x_1),w(X_2)]=0$, which is same as saying that $X_1(w(X_2))-X_1(w(X_2))+[w(x_1),w(X_2)]=0$$X_1(w(X_2))-X_2(w(X_1))+[w(x_1),w(X_2)]=0$
There seems to be some mismatch.