Yes, you can compete in a tournament using a downloaded copy of Pokémon X or Y—as long as it was legitimately obtained through the Nintendo eShop.
A digital version purchased from the eShop has all the same capabilities as a physical cartridge; the only difference is you don't need to carry a game card. Pirated or illegal copies, however, are not permitted.