"fanatical enthusiasm for a cause or person, blindly shared by the masses;" 1845, a German word in a specialized philosophical sense taken whole into English (in the Edinburgh Review, which adds "a word untranslatable, because the thing itself is un-English"), from German Schwärmerei "noisy, dissolute pleasures; religious fanaticism," from schwärmen "to swarm," figuratively "to be enthusiastic" (related to the noun Schwarm; see swarm (n.)).
The second element might be the German equivalent of -ery, but the sense is not clear. Perhaps the meaning in -rei is essentially diminutive and also denotes ridiculousness or contemptibility [a suggestion from D. Boileau, "Nature and Genius of the German Language," 1843, who cites among other examples Liebelei, "vulgar, insipid sweethearting," Ausländerei "too-frequent use of foreign words"].
Used in German by Kant, Schelling, Hölderlin; used in late 19c. English by Carlyle, Ruskin, etc.
But we are in hard times, now, for all men's wits; for men who know the truth are like to go mad from isolation; and the fools are all going mad in "Schwärmerei,"—only that is much the pleasanter way. [Ruskin, "Fors Clavigera"]
In mid-20c. also "schoolgirl crush." Related: Schwärmerisch.