Prologue. The main character, Hajime Miyoshi is reminiscing. In a scene from before his birth, his father Tatsusuke Miyoshi has taken his wife Tamae and two daughters Chizuru and Miyo to visit Tamae’s mother, Ayaka Noge who is the leading merchant in the local town’s commercial and entertainment district. The reason for the visit is to ask Ayaka for a loan to purchase a local coal mine. Tatsusuke’s right-hand man Nojima, Tamae’s younger brother Shinji and uncle Gisuke are also there. Ayaka is a cool-headed businessperson, but feeling the sincerity and determination in Tatsusuke, and also wishing to help her daughter and grandchildren, she decides to lend the money, although at a high interest rate and on the condition that it be repaid within two years. Thus she becomes underwriter of the mine’s purchase. However, just after things appear to have reached a fortuitous conclusion, the pregnant Tamae suddenly goes into labor and dies in the process of giving birth to the son Hajime.
Tatsusuke overcomes the loss of his wife and devotes himself to running what is now his Akabori Coal Mine. Tatsusuke’s policy is to treat the miners well and offer good wages to motivate them and increase productivity in the mine. The result is financial success for the Akabori Coal Mine, and eight years pass in no time at all.
Act One. The scene is the Miyoshi home. Around the house, the sunflowers that the late Tamae had loved so much are in full bloom. Tamae had told her daughters to always keep a smile on their faces like the sunflower, in good times and bad. The maid Suzuko is doing housework, and the grandfather Jinpei, a carpenter, is fixing up the small separate cottage as a study room for the young son Hajime. Next to the cottage is a small shrine gate that sanctifies a closed mineshaft. The daughters Chizuru and Miyo have come home from school and Hajime teacher, a Mr. Kato, has come for a home visit. The everyday scene is filled out when Tatsusuke brings home some miners for drinks after their shift.
Then Ayaka appears, bringing Shinji and Gisuke and his wife along with her. Her business has not been going well lately and she has come to borrow money, and also to ask for better salaries for Shinji and Gisuke, who are now employees of the Akabori Mine. In the continuation of Tatsusuke’s drinking with the miners, the conversation turns to the deceased miner Yanase who suffered from carbon monoxide poisoning after a mine accident and eventually killed himself, leaving behind his wife and mother. Tomorrow is the Buddhist ceremony commemorating the anniversary of his passing, someone says.
As the son of the family, there are great expectations placed on Hajime, but he is weak in constitution and has taken to leaving offerings of sweets at the shrine gate and making wishes to the deity of the shrine. Out of the nearby bushes comes a dingy-looking little boy riding on the train made of paper, who takes the sweets Hajime has just set at the shrine gate. The boy tells Hajime to get on the train with him. Hajime calls the boy “Kami-sama” (holy deity) and from that evening they become friends.
The next day, Tatsusuke goes to the west part of town to visit the late Yanase’s widow, Mizue and the mother, Fuku. It is a neighborhood where the poorest people of the town live. When Tatsusuke tries to give Mizue an envelope of condolence money she denounces him vehemently.
In a different time and place, scenes of the exchanges between Hajime and Kami-sama are depicted. In the midst of a daydream where Hajime’s dream of becoming a baseball player is about to come true, his father Tatsusuke comes home. Tatsusuke scolds Hajime for playing outside until late into the night. Then, seeing a baseball bat on the ground nearby, the two begin to practice baseball. Just then a siren sounds the signal that there has been an accident at the mine.
Act two. After the accident in the mine ground water and rainwater begin to fill one of the shafts and seventeen miners are trapped inside, and then a methane gas explosion occurs. To keep the explosions from spreading, Tatsusuke must make the tough decision to flood the shaft, even though it will sacrifice the lives of the trapped miners.
Tatsusuke and his family are blamed by some for the accident and they become the target of a torrent of local criticism. With no prospects of reopening the mine any time soon, and with compensation payments to be made to the families of the victims the company is soon on the brink of collapse.
Hajime asks Kami-sama to help him build a “swimming locomotive” that can cross the cold underground sea that has been created by the tears and sorrow of the miners and warm it with the locomotive’s steam.
Finally, driven to desperation, Tatsusuke disappears. The government’s energy policies of the day are also causing the market price to coal to begin to collapse.
Ayaka visits the Miyoshi home to announce that she has found relatives willing to take in her three Miyoshi grandchildren. Meanwhile, Jinpei and other miners burst in demanding their unpaid wages. Amid the ruckus Ayaka passes away, like a withering old tree. The maid Suzuko also leaves the Miyoshi home, as Hajime and his sisters gradually lose the people they have depended on one by one.
Kami-sama shows up for the first time in a while. Being hold that Hajime will be leaving the town after the New Year he tells Hajime to run away from home and build the swimming locomotive with him. The place Kami-sama lead them in search of materials to make the locomotive is the same western part of town where the Yanase widow Mizue lives. There, Hajime sees his father Tatsusuke, who is now living with Mizue. Hajime runs after him, but his father doesn’t answer and runs screaming into the water. Mizue comes out and tears the two apart, leading Tatsusuke into the house.
Hajime is left in trauma. He says it will be impossible now for him to build the swimming locomotive and warm the sea of tears and runs off, leaving Kami-sama alone. Back in Mizue’s Tatsusuke hangs himself.
The next day. The relative Matsuo who has offered to take Hajime and his sisters in appears. Matsuo looks like a good person, much to the relief of the children. But soon Gisuke and some of the other miners show up and start to carry away things in the Miyoshi house that look saleable. When Matsuo and Shinji try to stop them it turns into a brawl. The children realize with this that they have indeed lost everything now.
It is a cold day just after the New Year. Only Shinji is there to see the children off when Matsuo comes for them. As they walk away, Shinji runs after them and Hajime stops. He opens the cover of the closed mine shaft under the shrine gate and calls out to Kami-sama.
Then a vision of Kami-sama appears surrounded by a field of sunflowers in full bloom. Kami-sama doesn’t try to stop Hajime from leaving. Instead, he waves his hand, telling Hajime to be strong and do his best. Then, amid the falling petals in the field of sunflowers Hajime sees his departed mother Tamae, grandmother Ayaka and his father as Tatsusuke. In strong voices, the three call out to Hajime, telling him to “Live on.”
He calls back, promising that even though times may be hard he will someday build his locomotive and run it in the cold sea.
“I will be strong, I will carry on … for the people I love!”
The stage is transformed all at once into a great expanse of sea. A giant locomotive appears, plowing across the sea, and carrying this image, Hajime strides off with determination.