If it's a machamp with no guard, then this is fine. The ability no guard allows machamp to hit a pokemon while it is underground, in the air, or underwater. That works as intended.
Link in case you want some further reading^^
https://bulbapedia.bulbagarden.net/wiki/No_Guard_(Ability)
okay, i don't remember if it's machamp or not
but thx :D