This is a folktale that precedes its Jewish iterations, often taking place either in a Christian hell or in the houses of inhospitable people. The Jewish story's closest descendant is a Romanian folktale type, such as "Das Gastmahl des Teufels" published in 1928 by German folklorist Adolf Schullerus (1864-1928), about a man serving his guests with long spoons (cf. Verzichnis der Rumänischen Märchen und Märchenvarianten). Folklorist Haim Schwarzbaum claims that versions of this story stretch back to Aesopic tradition, and in the Jewish world, to Berechiah ben Natronai's (13th c.) fable of the Fox and the Crane (cf. Schwarzbaum's Studies in Jewish and World Folklore). In Berechiah's story, the Crane punishes the greedy Fox by inviting him to a meal; the food is stuck deep in a tree that requires a long beak, leaving the Fox starving (the tale can be read in the translated Fables of a Jewish Aesop).
However, if you're looking for the first printed source that attributes the story to R. Haim visiting heaven and hell, then that source is a Hebrew anthology of Jewish humor called Sefer habedichah vehachidud [The Book of Jokes and Riddles] collected by the Lithuanian writer and researcher Alter Druyanov (1870-1938). The anthology was first published in 1935, and the original story in question appears in the second volume under the section titled "bein adam l'chavero" [between man and fellow]. It goes like this:
: רבי חיים רומשישקר דרש ברבים וסיפר
פעם אחת עליתי לשמים ונכנסתי לגיהנום. נסתכלתי וראיתי: זקנים וצעירים יושבים שורות־שורות לפני שולחנות מלאים כל־טוב, ובידו של כל אחד ואחד קשורה כף ארוכה, ולהגיעה לפיו אינו יכול מחמת אורכה. וכך היו יושבים כולם שורה כנגד שורה ונפשם יבישה וצער גדול כבוש בפניהם. ניגשתי לאחד מהם ואמרתי לו: ״שוטה שבעולם ! עד שעיניך רואות כל טוב וכלות, שלח את הכף הקשורה בידך ופרנס את חברך היושב ממולך ויחזור הוא ויפרנס אותך בכף הקשורה בידו״
: הציץ עלי האיש בעיניים זעומות והחזיר לי
״מוטב, שתהיינה עיני רואות וכלות כל היום משאראה אותו נהנה ושבע שעה
אחת״. נבהלתי לשמוע ופתחתי פי לצעוק צעקה גדולה והקיצותי
Rabbi Haim Romshishker publicly expounded and told the following:
Once, I went up into the sky and also entered hell. I looked around and saw: old and young men sitting rows upon rows in front of tables that were full of all the best things, each holding a long spoon in hand. And when one reached for his mouth, he wouldn't be able to because of the spoon's length. And so they all sat row against row with their souls dry and a great sorrow rested on their faces. I went over to one of them and said to him: "A fool in the world! Rather your eyes seeing all this goodness and craving, send the spoon that is attached to your hand and support your friend who sits opposite you. And he will, in turn, support you with the spoon attached to his hand."
The man looked at me with meager eyes and replied:
"It would better for my eyes to see and crave all day long than for me to see him enjoy and be satiated.
" I was alarmed to hear this, so I opened my mouth to scream a loud
scream and woke up.