This story comes from the Bhagavata Purana, a sacred text of Hindu tradition. Later poets gave Krishna's friend the name Sudama, and that is how most families know him today.
When they were boys, Krishna and Sudama studied together in the ashram of the teacher Sandipani in Avanti, the city now called Ujjain. They shared lessons, chores and games. Once their teacher's wife sent them into the forest to collect firewood, and a great storm broke over them. All night the two boys stayed together in the rain and darkness, holding hands so they would not lose each other. In the morning their teacher found them and blessed them.
Years passed. Krishna became the king of Dwarka, a shining city by the sea. Sudama became a learned and gentle brahmin, but he was very poor, and often his family did not have enough to eat. He never complained, and he never thought of asking anyone for help.