Hechavarria, 29, was hitting .258 with three homers and 26 RBIs, and he had lost his starting role to rookie Willy Adames.
Tampa Bay made the move Wednesday and has seven days to trade or release Hechavarria, who had beaten the Rays in salary arbitration last winter. If Hechavarria is released, the Rays would be responsible for the remainder of his $5.9 million salary.
Hechavarria said he didn't want to talk about the decision, team spokesman Dave Haller said.
Pham was obtained from St. Louis for three minor leaguers.