Why was the second Battle of Bull Run fought?

Because two Union armies were about to join forces. Together, they would have overwhelmed Lee and put Richmond in peril.

So Lee moved fast, and defeated the smaller force before reinforcements could arrive.