Active galactic nuclei (AGNs) have long been observed to twinkle (i.e., their brightness varies with time) on timescales from days to years in the UV/optical bands. Such AGN UV/optical variability is essential for probing the physics of supermassive black holes (SMBHs), the accretion disk, and the broad-line region. Here we show that the temperature fluctuations of an AGN accretion disk, which is magnetically coupled with the corona, can account for observed high-quality AGN optical light curves. We calculate the temperature fluctuations by considering the gas physics of the accreted matter near the SMBH. We find that the resulting simulated AGN UV/optical light curves share the same statistical properties as the observed ones as long as the dimensionless viscosity parameter $alpha$, which is widely believed to be controlled by magnetohydrodynamic (MHD) turbulence in the accretion disk, is about $0.01$---$0.2$. Moreover, our model can simultaneously explain the larger-than-expected accretion disk sizes and the dependence of UV/optical variability upon wavelength for NGC 5548. Our model also has the potential to explain some other observational facts of AGN UV/optical variability, including the timescale-dependent bluer-when-brighter color variability and the dependence of UV/optical variability on AGN luminosity and black hole mass. Our results also demonstrate a promising way to infer the black-hole mass, the accretion rate, and the radiative efficiency, thereby facilitating understanding of the gas physics and MHD turbulence near the SMBH and its cosmic mass growth history by fitting the AGN UV/optical light curves in the era of time-domain astronomy.