For the functoriality aspects, the two key properties of $L$-functions are additivity ($L(s,\rho_1 \oplus \rho_2) = L(s, \rho_1)L(s,\rho_2)$) and inductivity ($L(s,I_{E}^F(\rho)) = L(s, \rho)$), and for this it matters what the precise form of the local factors are. Roughly you want it to be a "characteristic polynomial" of the representation (at least for a finite-dimensional Galois representation---on the automorphic side, you want the analogous thing for Langlands parameter) so that additivity will hold.
Recall that the correspondence between Galois and automorphic representations, is says that the representations should locally correspond at almost all places, so it suffices to look at unramified places, where both sides should reduce to the 1-dimensional case of local class field theory. Then the additivity of $L$-functions says the $L$-functions correspond. Of course the main problem in functoriality is showing that $\pi = \otimes \pi_v$ is (globally) automorphic---constructing the $\pi_v$ for almost all $v$ is easy. Then inductivity is useful to get compatibility with base change.
Note: not all Dirichlet series formed from arithmetic objects should give automorphic $L$-functions. For instance, Koecher-Maass series (constructed with Fourier coefficients of Siegel modular forms) and zeta functions of binary cubic forms don't have Euler products. Also, Zagier's "Naive BSD" paper considers variations of $L$-series of elliptic curves which do have Euler products, but not (apparently) meromorphic continuation to $\mathbb C$. So it's better to look at things where, say $a_n$'s are multiplicative, and the $a_p$'s are traces of representations.
Edit: Upon rereading my answer, I realize I may not have spelled out a couple conclusions explicitly:
The above reasoning more-or-less motivates the definition of $L$-functions of Galois representations. The automorphic definition is then motivated by a combination of the result of Hecke that gives $L$-functions of modular forms as integral representations combined with the predictions of the local Langlands correspondence.
My point of view is that the reason $L$-functions connect different ares of mathematics is because they reflect things like the global Langlands correspondence. Unfortunately, I don't have a good intuitive explanation for why Langlands' conjectures should be true (one can make the trite remark that it generalizes class field theory, but that doesn't answer why in my mind).