Which Hecke algebra is used in representation theory? Which Hecke algebra is used in representation theory or more specifically in the study of Langlands's conjecture ?
From here, the Hecke algebra is constructed from a locally compact topological group and its closed subgroup.
While from here, the Hecke algebra is defined in terms of Hecke operators which are coming  from Modular forms.
This makes me confused.
Are the above two definition literally and mathematically equivalent ?
If not, which one is used in the study of Local/Global Langlands's conjecture ?
Any explanation will help me.
 A: Both are used and they are basically equivalent.  What I'm going to say is technically incorrect in some details but the general idea is right.
To make life easy, assume $f$ is a modular cusp form for $\operatorname{SL}_2(\mathbb Z)$ which is a normalized eigenfunction of all Hecke operators $T_p$.  There is a way (actually several, slightly inequivalent ways) to associate $f$ to an automorphic form $\phi: \operatorname{GL}_2(\mathbb Q) \backslash \operatorname{GL}_2(\mathbb A) \rightarrow \mathbb C$.  Let $G = \operatorname{GL}_2$.  The function $\phi$ lives inside the space $L^2(G(\mathbb Q)Z_G(\mathbb A) \backslash G(\mathbb A))$ and generates an irreducible representation $\Pi$ inside there.
Let $G_p = G(\mathbb Q_p)$ and $K_p = G(\mathbb Z_p)$.  There are unique irreducible, admissible representations $\pi_p$ of $G_p$ and a representation $\pi_{\infty}$ of $G_{\infty} = G(\mathbb R)$ such that $\Pi$ contains the "infinite tensor product" representation $\otimes_{p \leq \infty} \pi_p$ as a dense subspace (some work needs to be done to make sense out of an infinite tensor product).  Assume each representation $\pi_p$ of $G_p$ has a nonzero vector fixed by $K_p$.
Let $H_p = \mathscr C_c^{\infty}(K_p \backslash G_p/K_p)$ be the convolution ring of locally constant and left and right bi-$K_p$ invariant complex valued functions on $G_p$.  This is one of the kinds of Hecke algebras you were considering.  These particular Hecke algebras turn out to be commutative rings with unity.  Let $H_{\operatorname{fin}}$ be the infinite tensor product of the rings $H_p : p < \infty$.
The function $\phi$ lies in $\otimes_{p \leq \infty} \pi_p$ and in fact is itself equal to an infinite tensor product $\phi = \otimes_{p \leq \infty} \phi_p$ with $\phi_p \in \pi_p$.  The Hecke operators $T_{p^n} : n \in \mathbb N$ scale the cusp form $f$, but if we identify $f$ with the automorphic form $\phi$, then the $T_{p^n}$ affect only the component $\phi_p$.  In fact, $T_{p^n}$ identifies with a certain element in $H_p$, and $H_p$ is generated as an algebra by the $T_{p^n}$.
In this way, the tensor product of the "local Hecke algebras" $H_p$ form the "global finite Hecke algebra" $H_{\operatorname{fin}}$, which can also be thought of as being generated by the operators $T_{p^n}$, for $p$ prime and $n\in \mathbb N$.
