The 26-year-old, who joined the Hammers from Pachuca for £12m in 2014, had held talks with Swansea on Wednesday.
But he will now link up with the Toffees on his return from international duty with Ecuador.
Valencia had made six appearances this season but was facing competition from new Hammers signing Simone Zaza.
Meanwhile, Everton have signed Sheffield United forward Dominic Calvert-Lewin for an undisclosed fee on a four-year deal.
The 19-year-old made 11 league appearances for the Blades, failing to score.
Subscribe to the BBC Sport newsletter to get our pick of news, features and video sent to your inbox.
Everton have signed West Ham striker Enner Valencia on a season-long loan, with the option of a permanent £14.5m move next summer.