Unlike most vanity pets, it is gained in a highly unusual method.
Every chicken you see in the game has a small chance of offering you a quest when you use the /chicken (or /flap) emote in front of it. If you cluck at a chicken enough, it will "looks at you puzzled. Perhaps you should inspect it". When it does, use the /cheer emote with the chicken selected. The chicken will change from neutral to friendly. When it does, talk to it to get  . Note that the exclamation mark does not show up above the chicken unless you are very low level. Also, once the chicken has been clucked at enough, anyone nearby that chicken can get the quest for the brief time that the chicken is friendly.
For your own sanity, it is strongly suggested you write a macro that does /chicken (or /flap) over and over to activate this quest.
The quest requires you to get Special Chicken Feed which you can buy from in Westfall or in Brill. You can buy the feed beforehand to speed things up. Next, /cheer at any chicken (there are some near the farmer) and give the chicken the feed. The chicken will then lay a Chicken Egg, which you can take to learn how to summon a chicken.
It is possible to do this quest multiple times and get multiple eggs.
It used to be difficult to acquire the chicken egg without a workaround as a member of the Horde. Horde players could not complete the quest so you used to require an Alliance player to complete the quest in order to loot the egg. However, as of patch 3.1.0, Horde players can obtain the quest. For posterity, here are the methods that Horde used to have to go through to obtain the egg.
It is possible for a Horde player to pick up a chicken egg once it is on the ground and therefore it is possible for an Alliance player to do the quest and allow the Horde player to pick up the chicken egg.
On your Horde character, go to Westfall and log out near farmer Saldean. Go on an Alliance character on that server, or if you do not have one, create one. Head to Westfall, making sure you have the 25 copper to buy the special chicken feed, and preferably more in case something goes wrong. You can farm this if necessary in your starting zone. Avoid any and all mobs in Westfall if you just created your character, they will kill you. Go to Farmer Saldean and buy his feed. Go find a semi-hidden chicken, get the quest, give the feed, and the chicken will lay the egg. Log out. Log in on your Horde character and pick up the egg.
Do the same thing as Method Two, but make your Alliance character on a free trial account.
This macro will do the chicken emote 50 times:
/run for i = 1, 50 do DoEmote("CHICKEN") end
Another macro that is less likely to lock UI, doing one emote per second, about 52 times:
/run f=CreateFrame("Frame") f.n=0 f.u = 0 f:SetScript("OnUpdate", function() t=GetTime() n=this.n if n > 50 then this:Hide() elseif t>this.u then this.u=t+1 this.n=n+1 DoEmote("CHICKEN") end end) f:Show()
Another method would be to type "/chicken" into Notepad or any writing program available, then copy/paste exponentially (ie. copy then paste five times, then copy those five and paste two times, copy those 15, etc.):
Once you have a large batch, copy, open up WoW, make a new macro and Ctrl-V into the Command window. In reality though, you can only fit 28 complete lines into the window, taking up 251 of the 255 characters available. You will only have to use the macro twice, if even that, to trigger the quest.
You can also create a macro that has just 1 /chicken in it and put on your action bar. Then just sit there and spam it till the chicken pops a quest.
Note that, if you decide to spam /chicken over and over very quickly, you should do it in areas with few or no players, as it can irritate others very quickly to have their chat filled with the chicken taunt message.