Whereas the major components of human body are hydrogels, polymer networks infiltrated with water; machines that interact with living organisms are mostly made of metals, silicon, glass and rigid polymers. Owning to hydrogels’ superior biocompatibility and bioactivity, hydrogel machines that can quickly swell up in human body, perform long-term functions and degrade on demand will enable new possibilities in pharmaceutics, medical devices and human enhancement. However, properties of high swelling ratio and speed, long-term robustness, and degradability do not co-exist in conventional hydrogels, severely limiting their innovations and applications. In nature, pufferfish can rapidly inflate its body into a large balloon by imbibing water, while maintaining the body’s strength. Here we introduce a pufferfish-inspired hydrogel machine capable of rapidly swelling (e.g., 10,000 vol. % in 10 min) into a large soft balloon (e.g., diameter 7 cm, modulus 3 kPa), which maintains robustness under repeated mechanical loads over long time (e.g., 26880 cycles of 20 N force over two weeks). The hydrogel machine also de-swells and disintegrates quickly in response to biocompatible triggers. In vitro and large-animal tests further demonstrate superior performances of the hydrogel machine as soft gastric-retentive devices for monitoring and diagnosis, nutritional modulation, and prolonged drug delivery.