In the Wikipedia article about the Hecke algebra of a locally compact group, it is noted that if we take $(\mathrm{GL}(2, \mathbb{Q}), \mathrm{GL}(2, \mathbb{Z}))$ as the pair $(G,K)$ of a unimodular locally compact topological group $G$ and a closed subgroup $K$ of $G$ and then look at its Hecke algebra, as in the space of bi-$K$-invariant continuous function of compact support $C_c(G)_K$, we get the usual Hecke algebra generated by the Hecke operators in the theory of modular forms.
Why is that? I get that there is some connection between the "double coset"-construction of the Hecke algebra of modular forms and the biinvariance of such functions, but I can not quite see the link between the maps $T_n: \mathbb{S}^k(\Gamma) \to \mathbb{S}^k(\Gamma)$ and biinvariant maps $f: G \to \mathbb{C}$ with compact support.
I know that there are similar questions on MSE, but most of them refer specifically to an adelic setting, and I think it should be possible to understand this connection without talking about adeles. Thank you in advance!
This is worked out in detail in my lecture notes "Modular forms and representations of GL(2)", https://warwick.ac.uk/fac/sci/maths/people/staff/david_loeffler/teaching/tcc-gl2/. See Lecture 5 in particular, section 6.2, for the dictionary between the representation-theoretic and classical definition of the Hecke op $T_p$.