Density functional theory (DFT) calculations are used to study the epitaxial growth and the magnetic properties of thin films of MnSi on the Si(001) surface. For adsorption of a single Mn atom, we find that binding at the subsurface site below the Si surface dimers is the most stable adsorption site. There is an energy barrier of only 0.3 eV for adsorbed Mn to go subsurface, and an energy barrier of 1.3 eV for penetration to deeper layers. From the calculated potential-energy surface for the Mn adatom we conclude that the most stable site on the surface corresponds to the hollow site where Mn is placed between two Si surface dimers. Despite Si(001) geometrically being an anisotropic surface, the on-surface diffusion for both directions along and perpendicular to the Si dimer rows has almost the same diffusion barrier of 0.65 eV. For coverage above 1 ML, the lowest energy structure is a pure Mn subsurface layer, capped by a layer of Si adatoms. We conclude that the Mn-silicide films stabilize in an epitaxially CsCl-like (B2) crystal structure. Such MnSi films are found to have sizable magnetic moments at the Mn atoms near the surface and interface, and ferromagnetic coupling of the Mn clarify within the layers. Layer-resolved electronic densities-of-states are presented that show a high degree of spin polarization at the Fermi level, up to 30 and 50% for films with one or two MnSi films, respectively. In order to clarify the stability of ferromagnetism at finite temperatures we estimate the Curie temperature (Tc) of MnSi films using a multiple-sublattice Heisenberg model with first- and second-nearest neighbor interactions determined from DFT calculations for various collinear spin configurations. The Curie temperature is calculated both in the mean-field approximation (MFA) and in the random-phase approximation (RPA). In the latter case, we find a weak logarithmic dependence of Tc on the magnetic anisotropy parameter, which was calculated to be 0.4 meV. Large Curie temperatures of above 200 K for a monolayer MnSi film, and above 300 K for a 2 ML MnSi film are obtained within the RPA, and even higher values in MFA. Complementary calculations are performed for non-collinear spin structures to study the limitations of the mapping of the system onto a Heisenberg model. We demonstrate that biquadratic interatomic exchange interactions and longitudinal fluctuations of atomic moments give important contributions to the energetics of the system.