Spontaneous magnetization of single and coupled quantum dots formed by lateral confinement of a high-mobility two-dimensional electron gas is studied for a realistic GaAs/AlGaAs heterostructure. The modelling of the device takes into account contributions from a patterned gate, doping, surface states, and mirror charges. To explore the magnetic properties we use the Kohn-Sham local spin-density formalism including the contributions from electron correlation and exchange. We show by explicit calculations that the exchange is the dominant mechanism driving a spontaneous magnetization of a dot. The correlation potential reduces the amount of level splitting and usually affects the electron content in the dot at a given gate voltage. These effects are, however, small and may be neglected under present circumstances. Single dots with up to 50 electrons have been studied.