Samorost 3 starts when a magical flute falls near the Gnome's house.The Gnome decides to find out where it came from and sets out on a journey through the cosmos. He speaks to an engineer and asks him to build a toadstool rocket, which he builds by reusing parts found scattered on his home planet.The Gnome flies from planet to planet and meets multiple creatures whom he helps with their problems using the flute.
The Gnome eventually discovers two illustrated books and learns that the flute belongs to four monks. Not long ago, the monks were all at peace, until a giant orange space octopus arrived from a black wormhole and started consuming planets. The monks saw the octopus coming and consulted an engineer (the same one from the Gnome's home planet) to build a three-headed watering spaceship controlled by the flutes on the back of which they can fly, and a mechanical knight powered by a black orb with which to fight the octopus and save the universe. The knight dismembers and kills the octopus, then the knight goes to sleep on a moon, and the orb is locked away and protected by a guardian monk.
In the second book, one of the four monks uses his flute to create evil spirits, and the other three monks banish him for doing so. He secretly takes the spaceship and converts it into a three-headed fire-breathing mechanical dragon. Flying on the dragon, he snatches the other three flutes from the monks and casts the monks out of their mountain castle. However one of the flutes flew away, and this is the flute that landed on the Gnome's planet. He then uses the dragon to consume good spirits which he finds on other planets and then seizes the black orb so that the knight cannot be awakened.
The Gnome eventually reaches the planet of monks, sneakily steals the black orb from the evil monk, and uses it to revive the mechanical knight who then slays the dragon and presumably killing the evil monk in the process.The Gnome celebrates by playing music with the remaining three monks, who reward him with the power to travel instantly across all the planets and returns the black orb to its guarded storage.The Gnome finally returns to his home planet to greet his dog.