We systematically study the interesting relations between the quantum elliptic Calogero-Moser system (eCM) and its generalization, and their corresponding supersymmetric gauge theories. In particular, we construct the suitable characteristic polynomial for the eCM system by considering certain orbifolded instanton partition function of the corresponding gauge theory. This is equivalent to the introduction of certain co-dimension two defects. We next generalize our construction to the folded instanton partition function obtained through the so-called "gauge origami" construction and precisely obtain the corresponding characteristic polynomial for the doubled version, named the elliptic double Calogero-Moser (edCM) system. X-function in this case. Finally we demonstrate the validity of X-function by recovering the correct commuting Hamiltonians which are expressed in terms of the Dunkl operators generalized to the edCM system. We should comment here that the connection between edCM systems and the so-called "folded instanton" configuration derived from gauge origami construction was noticed in [7], in this work we firmly established this connection by working out the relevant details in steps.We discuss various future directions in Section 6. We relegate our various definitions of functions and some of the computational details in a series of Appendices.1 This X-function itself is also known as the fundamental q-character of A 0 quiver constructed in [14]. See also [15] for another construction through the quantum toroidal algebra of gl 1 . As mentioned in this paper, we need to consider the orbifolded version of the X-function in order to extract the commuting Hamiltonians of the eCM system. 2 The trigonometric version is studied, e.g., in [20,21]. 3 ゲージ折紙 (日本語); 規範摺紙 (中文 繁體字); 规范折纸 (中文 简体字).(2.12)where the symbol PV means the principal value integral. In 2 → 0 limit, the integration should be dominated by saddle point configurations, which yield:dyG(x αi − y)ρ(y) + log(qR(x αi )) = 0.(2.13)