Why is it important to have a classifying space for principal $G$-bundles over a based space $X$?

The space $BG$ has a non-trivial cohomology $H^*(BG;A)$ with coefficients in a group $A$. Now any fiber bundle over $X$ is equivalent to a homotopy class of maps $X\rightarrow BG$. But from this we get a map $H^*(BG;A)\rightarrow H^*(X;A)$. If this map in cohomology is non-trivial, the fiber bundle is non-trivial. An element in the image of this map is called a characteristic class for the fiber bundle. Stiefel-Whitney, Chern, and more exotic things are all examples of characteristic classes.

Sometimes one also might be able to explicitly compute the set $[X,BG]$ by other means (for example obstruction theory). Then you know all bundles! A good example is $BS^1=CP^\infty$. Then we know that all principal bundles $S^1$ are classified by $[X,\mathbb CP^\infty]$. But this set coincides with $H^2(X;\mathbb{Z})$ as $CP^\infty$ is also a $K(Z,2)$. One of the miracles of topology.


It is not just the fact that there is a bijection $[X, BG] \to \operatorname{Prin}_G(X)$, but also the form of the bijection which is useful. There is a universal principal $G$-bundle $EG \to BG$ and the bijection is given by $[f] \mapsto f^*EG$; that is, every principal $G$-bundle $P \to X$ is obtained by pulling back the universal principal $G$-bundle by some map $f : X \to BG$ (called a classifying map for $P$).

This description can be used to prove general facts about principal $G$-bundles by proving them 'universally', i.e. for the universal principal $G$-bundle. For example, you can prove the following fact by working universally: for a real line bundle $\ell$, we have $c_1(\ell\otimes_{\mathbb{R}}\mathbb{C}) = \beta(w_1(\ell))$ where $c_1$ and $w_1$ are the first Chern and Stiefel-Whitney classes respectively, and $\beta$ is the Bockstein.