Spontaneous symmetry breaking underlies much of our classification of phases of matter and their associated transitions1-3. The nature of the underlying symmetry being broken determines many of the qualitative properties of the phase; this is illustrated by the case of discrete versus continuous symmetry breaking. Indeed, in contrast to the discrete case, the breaking of a continuous symmetry leads to the emergence of gapless Goldstone modes controlling, for instance, the thermodynamic stability of the ordered phase4,5. Here, we realize a two-dimensional dipolar XY model that shows a continuous spin-rotational symmetry using a programmable Rydberg quantum simulator. We demonstrate the adiabatic preparation of correlated low-temperature states of both the XY ferromagnet and the XY antiferromagnet. In the ferromagnetic case, we characterize the presence of a long-range XY order, a feature prohibited in the absence of long-range dipolar interaction. Our exploration of the many-body physics of XY interactions complements recent works using the Rydberg-blockade mechanism to realize Ising-type interactions showing discrete spin rotation symmetry6-9.