Artificial viscosity is a numerical tool employed in computational fluid dynamics to stabilize and regularize the simulation of shock waves and discontinuities by smoothing out the rapid changes in fluid properties. It helps in preventing unphysical oscillations near shock fronts, ensuring more accurate and stable numerical solutions when modeling complex fluid flows.