The sudden closure of a valve during the gravity-driven drainage of the liquid or granular medium causes the backward flow of material and generates a strong backward pressure wave. The phenomenon, which has a strong similarity with classical water hammer, is reported for the first time. Under specific conditions, the formation of the jet is observed at the free surface. The current article presents a detailed computational investigation of the unique phenomenon of backward propagation of materials and jet formation. A detailed comparison of the flow phenomenon for liquid and granular medium of constant bulk density is reported providing a particular emphasis on jet formation in these two cases. Distinct stages of flow dynamics are observed particularly for granular medium. For liquid, the runout time for the jet formation has been quantified analytically to appreciate the energy dissipation. The analytical model also produces good agreement (+10.75%, −8.9%) with the trained model based on numerical results. A detailed parametric study is incorporated for aspect ratio and valve height ratio to characterize and compare the phenomenon for both the flowing medium, − liquid, and granular matter.