I don't think there's much of a story but I found this on bulbapedia -
The rear head attacks in response to smells and sounds. Approaching this Pokémon from behind can cause the rear head to suddenly lash out and bite. While Girafarig sleeps, the head on its rear keeps watch, as it does not need to sleep. While Girafarig is eating, its tail makes chewing and swallowing motions as if it were also eating.
I think this answers your question ;)