If the gyarados was mega, then it gets mold breaker which negates abilities that prevent moves from going through, such as levitate, that would mean mega gyarados could hit rotom-w even with levitate.
If it was regular gyarados, that should be impossible unless a move was used to render abilites useless such as gastro acid