We present a detailed analysis of the stellar mass content of galaxies up to z=2.5 in the K20 galaxy sample, that has a 92% spectroscopic completeness and a complete $UBVRIzJK_s$ multicolor coverage. We find that the M/L ratio decreases with redshift: in particular, the average M/L ratio of early type galaxies decreases with $z$, with a scatter that is indicative of a range of star--formation time-scales and redshift of formation. More important, the typical M/L of massive early type galaxies is larger than that of less massive ones, suggesting that their stellar population formed at higher z. The final K20 galaxy sample spans a range of stellar masses from M*=10^9Msun to M*=10^12Msun, with massive galaxies ($M*>10^11Msun) detected up to z~2. We compute the Galaxy Stellar Mass Function at various z, of which we observe only a mild evolution (i.e. by 20-30%) up to z~1. At z>1, the evolution of the GSMF appears to be much faster: at z~2, about 35% of the present day stellar mass in objects with M*~10^11Msun appear to have assembled. We also detect a change in the physical nature of the most massive galaxies, since at z>1 a population of massive star--forming galaxies progressively appears. We finally analyze our results in the framework of Lambda-CDM hierarchical models. First, we show that the large number of massive galaxies detected at high z does not violate any fundamental Lambda-CDM constraint based on the number of massive DM halos. Then, we compare our results with the predictions of renditions of both semianalytic and hydro-dynamical models, that range from severe underestimates to slight overestimates of the observed mass density at z<~2. We discuss how the differences among these models are due to the different implementation of the main physical processes. (Abridged)