We simulate the dynamical evolution of both collisionless "dark" particles and a dissipative gaseous ("baryonic") component in a flat universe in order to investigate the formation process of the luminous components of galaxies at the center of galactic dark halos. We assume that the initial density fluctuations are Gaussian with a power spectrum of the form P(k) is-proportional-to k-1. Our models assume that the gas amounts to 10% of the mass of the universe, and that both the gas and the dark matter are identically distributed in phase space at high redshifts. The gas is allowed to dissipate energy according to a cooling function corresponding to an H-He mixture with primordial abundances. We neglect the effects of star formation and supernova explosions. Our results confirm previous suggestions that the merging history of the surrounding halo is a key factor in the determination of the morphological type of a galaxy. The baryonic component is found to lose more angular momentum than could be predicted by dissipationless simulations. We observe the formation of dense, slowly rotating baryonic cores at the center of galactic dark halos. This provides an attractive explanation for the origin of the slow rotation and large densities observed in spheroids and elliptical galaxies. On the other hand, the loss of angular momentum by the gaseous component is so important that prominent, rotationally supported disks like those of bright spirals did not appear to be able to form in our simulations. We conclude that these structures may only form in a scenario including mechanisms preventing the baryonic component from sinking in the deep cores of nonlinear clumps at high redshift and losing a large fraction of their angular momentum during subsequent mergers. We speculate that star formation and supernova explosions could provide such a mechanism, and that these processes are essential for the formation of spiral galaxies.