What is the term for a bullet hitting a bystander in a gunfight?
When it misses the intended target and hits a bystander.
Crossfire would describe the entire scene. From the OED:
gunfire from two or more directions passing through the same area, often killing or wounding noncombatants: a photographer was killed in the crossfire.
The bullet itself would be described as a stray bullet. From the OED:
move without a specific purpose or by mistake, esp. so as to get lost or arrive somewhere where one should not be
This is called Collateral Damage.
If you are talking about an actual gunfight, as in two groups exchange gunfire, then the appropriate term would be crossfire as in caught in the crossfire.
While the term may technically mean somebody between the two groups, colloquial use will often include people that are merely within a reasonable area of conflict.
Collateral Damage is a US military concept, and while it does apply to what you are talking, it also applies to other actions that can injure or kill innocent bystanders. e.g. "The soldiers did not call in an air strike, as there would be too much collateral damage"