Your question is imprecise as stated. I'll try to explain 1) how to make it precise, 2) why the answer is No in general, and 3) a situation in which there's a positive answer.

1) Curvature is not inherent to the bundle: given a principal G-bundle, there are usually many different connections on it, which will have different curvature forms. For instance, trivial bundles always admit connections with zero curvature (aka flat connections) but these form a very small part of the space of all connections on the bundle. This is discussed in great detail for Riemann surfaces in Atiyah and Bott's famous paper on Yang-Mills theory from '82.

2) You asked whether having zero curvature (more precisely, having some connection with zero curvature) implies that the bundle is trivial. As Akhil said, the answer is no. The simplest example is that there are non-trivial bundles over non-orientable surfaces $S$, whose first Chern class is the unique non-zero element in $H^2(S;Z)$. These bundles are in fact flat. Melissa Liu and Nan-Kuo Ho have some nice papers about this.

More generally, if $M$ is a manifold then each representation of $\pi_1 M$ into the Lie group $G$ induces a flat $G$-bundle over $M$, namely $(M\times G)/\pi_1 M$, where $\pi_1 M$ acts diagonally. This bundle admits a connection, which essentially comes from pushing the trivial connection on $M\times G$ down to the quotient. It's formal that this connection has curvature zero. Quite often, though, the bundle will be non-trivial (as in the case of non-orientable surfaces, above). Chern-Weil theory (see Milnor-Stasheff, for instance) lets you describe the Chern classes of this bundle in terms of the curvature form, at least when working with real coefficients. This leads to the conclusion that the Chern classes of flat bundles are all torsion, at least over closed manifolds.

3) This leads to one interesting setting in which your question has a positive answer, of sorts: if $M$ is a closed manifold whose integral (co)homology is torsion-free, then any flat $U(n)$ bundle over $M$ is stably-trivial - see my answer here: https://mathoverflow.net/questions/55542/is-there-an-alternative-characterisation-of-vector-bundles-with-vanishing-charact/60245#60245

It's also worth mentioning that bundles admitting a flat (zero curvature) connection are the same as those whose structure group, in the sense of Steenrod's book on fiber bundles, has the discrete topology. This means that the transition functions can be chosen so as to be locally constant, and is also equivalent to saying that the bundle is induced by a representation of the fundamental group (specifically, the holonomy representation built from the connection). Some of these ideas are discussed in Steenrod's book, and also in Spivak volume II (Chapter 9, I think). Morita's books (Geometry of Diff. Forms and Geometry of Characteristic Classes) also have a lot of discussion of flat bundles. I wrote a brief appendix to a paper (arXiv:0710.0681) covering some of these ideas, in particular the fact that each flat bundle can be recovered from its holonomy representation.


Kobayashi-Nomizu discuss flat connections in Section II.9 of the first volume of their book and in particular derive the following as a corollary of earlier results.

Let $P \to M$ be a principal bundle equipped with a flat connection. If $M$ is simply connected, then $P$ is trivial.