How do journals gain and lose reputation? This is something I've been curious about for a while, and there's little public or explicit information about it. It's obvious that some journals are considered very prestigious and other journals something less than that. It seems most seasoned professors have quite specific opinions on the matter. But how did things get this way? It seems that almost all journals superficially look and operate about the same. I work in mathematics, but the question of course applies to all fields. 

In some cases it's understandable. For example, the "Journal of the American Mathematical Society" would be expected to be a top journal since it's the flagship journal of a major mathematical institution. On the other hand, there are journals that are considered "top journals" without being attached to an important institution, having a long, distinguished history, or any other obvious reason. How did such journals acquire their reputation? I'm hesitant to start naming specific journals in this question, though it would be interesting to see some representative examples in the answers.

Reputation seems very much set in stone in the short term. And yet, over time, some journals rise in reputation while other ones decline. What causes this? One possibility is that a journal hurts its reputation by behaving in an unethical or irresponsible way, but this would not be the norm. 

To phrase this another way, I imagine just about every journal wants to improve its reputation. So what are the tools in the toolbox that a journal, or a community of academics who are invested in its success, can use to achieve this? 

I'm sure part of the answer is "the editors". But what do they do? Is the work of a journal/editor deeper than "wait for papers to get submitted and then accept the best ones"? I'm sure having a prestiguous editorial board helps, but in my experience even the "pretty good" journals still have top mathematicians as editors.
TL;DR Top journals tend to have that reputation because they're regularly publishing top papers. Similarly, journals that have a reputation for being "merely" pretty good tend to mostly publish papers that are "merely" pretty good.

I think that far and away the most important reason that certain journals acquire reputations for being strong journals is that they publish very interesting papers that prove important results. For example, if I'm asked to justify my belief that the Annals, JAMS and Inventiones are among the very strongest of all journals in pure mathematics, I'm definitely not going to say anything about mathscinet quotients or impact factors. Moreover, even though having a strong editorial board is incredibly important, I wouldn't mention that either. Instead I would use the fact that off the top of my head I can list a large number of seminal papers that were published in each of these journals. Similarly, if all the papers that I've read in a given journal seemed boring to me (or perhaps not even 100% correct), then I'm not going to think much of the journal and probably won't submit any papers there, regardless of what the many other journal ranking metrics say about the journal.

Since you asked for examples of new-ish journals that have acquired very strong reputations without being the flagship journal of an important mathematical institution, here are two: Geometry &amp; Topology and Algebra &amp; Number Theory. These journals were founded in 1997 and 2007 respectively and have already acquired reputations for being amongst the very strongest journals in their fields. The reason for this, I am sure, is that they both regularly publish extremely interesting papers. How do they attract such strong papers? I'm sure that part of the reason lies with their incredibly strong editorial boards. Having an editorial board full of very strong, well-known mathematicians is likely to result in a steady stream of strong papers since one of the most important factors to consider when choosing a journal to submit a paper to is the editor that will handle the paper. If I have a paper that I think is very strong then I'm not going to want to send it to an editor that I've never heard of and that might not even know what sort of people will make good referees. Instead I'd try to find a journal (at more or less the appropriate level) where there's an editor that I know works in my area and whom I suspect knows plenty of people that will do a good job of refereeing my paper. Thus, if your journal has a board full of well-known people that work in trendy areas then it's not too much of a stretch to imagine that before too long you'll be getting papers submitted that concern trendy areas, at least some of which are very strong and are written by other well-known people in the area (which in turn means that people citing their papers are likely to consider submitting their papers to your journal).