On the origin of variable gamma-ray emission from the Crab nebula