I want the player to be teleported when they reach y=0. I tried the
/execute command and it didn't work.
Unless you removed the bedrock from the world, there is no way to get to y=0. Commands like this:
/tp @p[y=0] 100 69 17
will rarely work because there are no block below y=0, and the player will fall past y=0 before they get teleported.
However, if there is a block underneath the player, then the
/tp command should work, but not at y=0.