The government just credits accounts. The money doesn’t have to come from anywhere other than the government’s decision—that’s why it’s called fiat currency!
To make sure there’s demand for money. It’s certainly not because the money is a scarce resource for them, since they are the monopoly issuer of the money.