From the Super Mario Wiki
Hat Trampolines are objects that appear in Super Mario Odyssey. They are red flowers that are closed when first seen, however, when Cappy is thrown at them, Mario captures/leads a Bullet Bill into one or ground pounds on it, they will open up. When Mario touches them in this state, they will launch him into the air, making him perform a Spin Jump in the air, similar to how Mario does a Spin Jump after jumping on a Spindrift in Super Mario 64 and Super Mario 64 DS. Some Hat Trampolines, primarily those seen in bonus areas, are open without having to throw Cappy at them.