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$.
Best Answer
There are basically 3 senses of "Hecke algebra", and they are related to each other. The modular-form sense is a special case of all three.
The oldest version is that motivated by modular forms, if we think of modular forms as functions on (homothety classes of) lattices: the operator $T_p$ takes the average of a $\mathbb C$-valued function over lattices of index $p$ inside a given lattice. Viewing a point $z$ in the upper half-plane as giving the lattice $\mathbb Z z + \mathbb Z$ makes the connection to modular forms of a complex variable.
One important generalization of this idea is through repn theory, realizing that when modular forms are recast as functions on adele groups, the p-adic group $GL_2(\mathbb Q_p)$ acts on modular forms $f$. To say that $p$ does not divide the level becomes the assertion that $f$ is invariant under the (maximal) compact subgroup $GL_2(\mathbb Z_p)$ of $GL_2(\mathbb Q_p)$. Some "conversion" computations show that $T_p$ and its powers become integral operators (often mis-named "convolution operators"... despite several technical reasons not to call them this) of the form $f(g) \rightarrow \int_{GL_2(\mathbb Q_p)} \eta(h)\,f(gh)\,dh$, where $\eta$ is a left-and-right $GL_2(\mathbb Z_p)$-invariant compactly-supported function on $GL_2(\mathbb Q_p)$. The convolution algebra (yes!) of such functions $\eta$ is the (spherical) Hecke algebra on $GL_2(\mathbb Q_p)$.
A slightly larger, non-commutative convolution algebra of functions on $GL_2(\mathbb Q_p)$ consists of those left-and-right invariant by the Iwahori subgroup of matrices $\pmatrix{a & b \cr pc & d}$ in $GL_2(\mathbb Z_p)$, that is, where the lower left entry is divisible by $p$. This algebra of operators still has clear structure, with structure constants depending on the residue field cardinality, here just $p$. (The Iwahori subgroup corresponds to "level" divisible by $p$, but not by $p^2$.) This is the Hecke algebra attached to the affine Coxeter group $\hat{A}_1$.
Replacing $p$ by $q$, and letting it be a "variable" or "indeterminate" gives an example of another generalization of "Hecke algebra".
The latter situation also connects to "quantum" stuff, but I'm not competent to discuss that.
Edit: by now, there are several references for the relation between "classical Hecke operators" (on modular forms) and the group-theoretic, or representation-theoretic, version. Gelbart's 1974 book may have been the first generally-accessible source, though Gelfand-PiatetskiShapiro's 1964 book on automorphic forms certainly contains some form of this. Since that time, Dan Bump's book on automorphic forms certainly contains a discussion of the two notions, and transition between the two. My old book on Hilbert modular forms contains such a comparison, also, but the book is out of print and was created in a time prior to reasonable electronic files, unfortunately.