They do go to your hand, but usually that's after knocking an opponent out. Which is usually after you attack. Which means itll be your opponents turn after you attacked.
So you shouldn't have been able to do that unless a pokemon's ability knocked out one of your opponents pokemon (like...