The air above a fire is hotter and less dense compared to the surrounding cooler air. This causes the light rays coming from objects behind the fire to bend as they pass through air layers of different densities. This bending of light is called refraction, and it makes the objects appear to sway or shimmer. So, the swaying appearance of objects is due to the refraction of light.
The correct answer is option (A) : refraction