They're not inserted as comments, but as a block of text that's offset from the rest of the post, so I think it's pretty clear that they're auto-inserted. You can search the site for "closed:1" to find questions with different messages that get inserted.
There is some control over how they're used. In most cases it takes 5 users with at least 3000 reputation to vote to close a question. The close reason that the majority selected is the one that gets displayed. Moderators (and employees of Stack Exchange) can close questions with a single vote if they're flagged, but we generally try to encourage people to use close votes if they have that ability.
Also, any closed question can be reopened by community vote whether it was closed by a moderator or by voting.