This study explores the dynamics of pressure wave propagation and cavitation in pressurized pipelines during and after the rapid closure of the pipeline's end ball valve, utilizing a three-dimensional computational fluid dynamics approach with the method of characteristics, validated against Bergant and Simpson's experimental data of three degrees of cavitation. It innovatively examines transient pressure dynamics through both energy transformation and wave propagation perspectives, focusing on the phases of water column separation and coalescence, and the dynamics of flow interruption bubbles. The research delves into the detailed mechanisms of pressure wave propagation and further assesses the effects of physical factors. Key findings include: (1) As initial inlet velocities increase, cavitation starts earlier, extends further, and intensifies, with higher final volume fractions near the valve, indicating that higher velocities exacerbate cavitation. Higher inlet velocities also correlate with more intricate and expansive vortex formations. (2) Secondary pressure surges in water hammer result from the superposition of two-stage positive pressure waves. Initially, positive pressure waves within the conduit reflect twice from air pockets and the upstream boundary, remaining positive. Subsequently, they interact with secondary positive pressure waves reflected by the valve, causing a secondary pressure surge. (3) The fluid flow is laterally symmetry in the pipe cross section, except for minor local asymmetrical spikes in areas with vapor bubbles. Velocity discrepancies are notable near the pipe walls due to vapor accumulation, primarily on the upper wall due to buoyancy. This accumulation may narrow the flow area, possibly accelerating the water passing by. (4) Lower flow velocities, downward inclines, and slower valve closures diminish secondary pressure rise amplitudes in water hammer events, while reduced static heads intensify cavitation despite lessening pulse amplitudes. These findings offer valuable insights for the design and operational guidance of complex hydraulic systems during transient processes in urban water supplies.