Why does the proper class construction of Stone–Čech compactification fail? Wikipedia's article on the Stone–Čech compactification gives several constructions of it, one which is this:

One attempt to construct the Stone–Čech compactification of $X$ is to take the closure of the image of $X$ in $$\prod\nolimits_{f:X\to K} K$$
where the product is over all maps from $X$ to compact Hausdorff spaces $K$. By Tychonoff's theorem this product of compact spaces is compact, and the closure of ''X'' in this space is therefore also compact. This works intuitively but fails for the technical reason that the collection of all such maps is a proper class rather than a set. There are several ways to modify this idea to make it work; for example, one can restrict the compact Hausdorff spaces $C$ to have underlying set $P(P(X))$ (the power set of the power set of $X$), which is sufficiently large that it has cardinality at least equal to that of every compact Hausdorff set to which $X$ can be mapped with dense image.

My question is, why does this construction of the Stone–Čech compactification "fail"?  Is there something illegitimate about an infinite product being a proper class, or about endowing a topology to a proper class?  Or is it about applying the axiom of choice to proper classes?  Or what?
Does the existence of $\prod\nolimits_{f:X\to K} K$ follow from either $NBG$ or $MK$?
 A: I'd like to give you a slightly more general perspective, assuming that you know a bit of category theory.
Let $Top$ be the category of topological space and $\bf CHaus$ the full subcategory of $Top$ given by compact Hausdorff spaces. Let $j\colon\bf CHaus \to Top$ be the inclusion functor.
The problem of finding the stone Čech compactification is equivalent to find a left adjoint $\beta\colon\bf Top \to CHaus$. Indeed, you search for a universal compactification in the following sense:  for any $f\colon X \to i(C) $ where $X \in\mathbf{Top}, C \in\mathbf{CHaus}$, there is a unique extension $ \beta X \to C$.
Does a left adjoint to the inclusion exist? We will invoke here the
General Adjoint Functor Theorem. If $C$ is complete and locally small and $R: C\to D$ preserve small limits, then $R$ has a left adjoint if and only if it satisfies the solution set condition.
The solution set condition can be stated as follows: for every object $Y \in D$, there exist a small set $I$ of maps $ Y \to R(X_i) $ that is "initial"; this means that for any $Z \in C$ and a map $Y \to R(Z) $, there exist some $i$ and a map $X_i \to Z$ so that
$$ Y \to R(Z) = Y \to R(X_i) \to R(Z) $$
The only if part is simple. If there exist an adjoint $L$, then $\{LY\}$ will be the solution set: for any $Y \to R(Z) $, by adjunction you have $LY \to Z$ , and it is a classical result that
$$ Y \to R(Z) = Y \to RLY \to R(Z) $$
Conclusions. Note that $\bf CHaus$ is stable for products and quotients, which gives that $\bf CHaus$ is complete. It is also locally small, because $\operatorname{Hom}(X, Y) $ is a set for any spaces $X, Y$. The inclusion preserve limits, because both products and quotients in $\bf CHaus$ are computed as in $\bf Top$.
Since hypothesis of GAFT are verified, the existence of the left adjoint is equivalent to find a small solution set. Since for any $f\colon X \to C$ where $C \in\bf CHaus$ this factors through $\overline{\operatorname{Im} f} \in\bf CHaus$, you can take the small solution set of compacts Hausdorff in which $X$ is dense, which is bounded in cardinality.
What I want you to focus on is that size can be a real issue, and there exist examples in which GAFT can't be applied; not because there is some argument involving classes that would do the job, but because the left adjoint does not exist at all. See example 3.1 at the nlab page:
https://ncatlab.org/nlab/show/adjoint+functor+theorem
