Below you will find some files of mine that you can use (to teach yourself how) to simulate data from various statistical models. Most of these files stem from teaching; either teaching simulation itself or for example to create data suitable for exams or exercises.
Simulation is a very helpful tool to learn about how statistical models work. You can of course also use data simulation to do simulation studies, for example for sample size analyses. You can also use it to help build theory or even to test theories. That is, you can simulate data generated from your theorized model, and compare the simulated data to real data, and see where discrepancies are and where they stem from in your model.
I'm sharing a few educational files that I at one point wrote for my bachelor students (who just learned about R and time series models) to teach them how to simulate data from n=1 autoregressive models. You could use them for that purpose as well. If you are completely new to data simulation, start with simple linear regression (see files listed above).
Note: if you want to use the files on AR(1) and VAR(1) models below to simulate data for research purposes, particularly the data generation for time point 1 in these files needs your special attention because it is oversimplified. If unsure why reach out to a methodologist that can help (e.g., me).
There are also various handy packages and tools that can do simulation for you, some of which I've listed below. Note that many data analysis packages in R wil also have a simulation feature. However, I highly recommend programming simulation code yourself as well (so do try the files above as well) - it will truly boost your understanding of any given model.