I seem to recall that the construction of Gal representations associated to eigenforms with CM was done much before the general cases due to EichlerShimura, DeligneSerre and Deligne. Was this done by Hecke? Can someone give the exact reference? Thanks.

1$\begingroup$ This may be a dumb question but: How do you define an eigenform having CM, if not by saying that it is attached to an abelian variety with CM? And once you have the abelian variety, the galois representation is obvious  you just act on the Tate module of the abelian variety. The significance of EichlerShimura (and I think also the other papers, though I'm less familiar with them) is showing how to attach an abelian variety to an eigenform. If you say the eigenform has CM, it seems to me that the question is already solved. Apologies if I am missing something here. $\endgroup$ – David E Speyer Oct 3 '11 at 18:57

1$\begingroup$ My understanding is that CM eigenforms were originally defined as arising from Hecke characters and then "someone" later showed that this is equivalent to the form being attached to an abelian variety with CM.The Gal repn then just falls out like you said... $\endgroup$ – unramified Oct 3 '11 at 19:07

3$\begingroup$ You can take a look to a paper of Ribet (especially sections 3 and 4), appearing in one of the Antwerp volumes (Modular Functions of one variable VI, LNM 601). There he explains how to construct CM forms from Groessencharacters and the other way around (Thm 4.5). $\endgroup$ – Tommaso Centeleghe Oct 3 '11 at 19:33

1$\begingroup$ @David: a CM form is one that is isomorphic to its twist by a quadratic character attached to an imaginary quadratic field. These are the modular forms that arise as automorphic induction from Hecke characters of type $(k1,0)$ on an imaginary quadratic field ($k\geq1$). Tommaso's suggestion of Ribet's article (dx.doi.org/10.1007/BFb0063943) is a terrific one. $\endgroup$ – Rob Harron Oct 3 '11 at 20:45

1$\begingroup$ Attaching $p$adic Galois representations to algebraic Hecke characters was done by Weil in the paper in which he introduced algebraic Hecke characters On a certain type of characters of the idèleclass group of an algebraic numberfield (1955). The Galois representation of a CM modular form is just going to be the induction of the Galois representation of the associated Hecke character. Now maybe people had already done such things in the special case of im. quad. fields (Weil doesn't mention any such work I don't think), but if not, you could try starting with that paper and seeing ... $\endgroup$ – Rob Harron Oct 3 '11 at 20:50
The idea of Galois representations attached to modular forms is one which evolved over the course of the 1960s, as far as I know. One should look at various papers of Serre from that time (available e.g. in his collected works), as well as his book on abelian $\ell$adic representations, to get a feeling for how the subject looked before it entered its "modern phase" with the work of Deligne, the ideas of Langlands, and so on.
In the particular case of CM forms, these modular forms and their associated $L$functions were understood by Hecke. In particular, I believe that he knew that the $L$function of such a modular forms was precisely the $L$function of the corresponding Grossencharacter.
Once one also knows about $L$functions attached to Galois representations, and the fact that they are invariant under induction, one sees that this is the same as the $L$function of the (family of $\ell$adic) Galois representation(s) attaced to the twodimensional representation of $G_{\mathbb Q}$ obtained by inducing the Grossencharacter from $G_K$ (where $K$ is the quad. imag. field of to which the Grossencharacter is attached).
However, Hecke didn't think in these Galois theoretic terms, as far as I know, and although at the same time that Hecke was working (and in the same place, I think  Hamburg) Artin was inventing his $L$functions, Artin was only thinking about finite image Galois reps., not reps. of the kind obtained from general algebraic Grossencharacters or their inductions. (This lack of communication between Artin and Hecke is commented on by Tate somewhere, which is where I learned about it.)
As Rob Harron points out in the comments, Weil was the one who introduced the notion of algebraic Grossencharacter. The theory was further developed in Serre's "abelian $\ell$adic representations" book, and here he carefully explains how to get compatible families of $\ell$adic representations from an algebraic Grossencharacter (and conversely, under suitable hypotheses; this converse is more or less the abelian case of what would later be called the FontaineMazur conjecture). Serre explains the relationship with CM abelian varieties, but I don't think modular forms make much of an appearance in this book. On the other hand, this book does contain the idea of $L$function of an $\ell$adic family of Galois reps., which is part of the infrastructure needed to relate Galois representations and modular (or, more generally, automorphic) forms.
As for the theory of CM abelian varieties, the relationship between these and algebraic Grossencharacters was first worked out by Shimura and Taniyama in their book (I think), and probably also appears in Weil's article (as well as in Serre's book, as already noted). The fact that every CM elliptic curve is modular was proved by Shimura (in a paper in the early 70s, if I remember correctly), using the passage from the elliptic curve to its associated Grossencharacter, and then from the Grossencharacter to the associated CM modular form. (This is a result in the opposite direction to the one you asked about, since it is about going from the Galois rep. to the modular forms; it seems worth mentioning though.)
Another related comment: if you look in Shimura's book "Arithmetic theory of automorphic functions", he talks about abelian varieties attached to weight two eigenforms, but I think that the focus is more on the abelian varieties rather than the underlying system of $\ell$adic Galois representations.
Summary: My overall take is that it took time for the idea of Galois representations attached to modular forms to evolve, with impetus from several different aspects of number theory and several different mathematicians. By the time Ribet wrote the article referred to in the comments, the whole picture was fairly clean, and he could make precise and straightforward statements about CM modular forms and the associated Galois reps. These were not new (in some sense)  they involve constructions and arguments going back to Hecke, Weil, Shimura, Taniyama, Serre, ...  but the language of Galois representations had only recently become available, and so Ribet may well have been the first to formulate them cleanly and generally in print.

2$\begingroup$ Serre was trying to understand Ramanujan's congruences for the $\tau$function, such as $\tau(p)\equiv1+p^{11}\mod{691}$ for every prime $p$. He (and SwinnertonDyer) realised that there is a Galois representation $\rho_\tau$ attached to $\tau$ and that the congruences for $\tau$ can be understood in terms of properties of $\rho_\tau$. This led him to conjecture that there is a Galois representation attached to every cuspidal eigenform, which was proved by Deligne in his Bourbaki talk. $\endgroup$ – Chandan Singh Dalawat Oct 4 '11 at 3:04