Despite a decent second half of last season, Hernandez wishes to move to La Liga as he has struggled to settle at the Hammers since arriving in 2017.
The 31-year-old has a year left on his deal and the club would not mind removing his £140,000-a-week wages from the salary bill.
If Hernandez does depart, West Ham are expected to renew their interest in Gomez, per the Evening Standard.
The Hammers attempted to sign Gomez in the winter but were rebuffed by his club Celta Vigo.
The Spanish side want his full release clause of £43.5 million, while the Hammers are reluctant to go above £30 million.
It is a move the Evening Standard expects to drag on until the end of the summer transfer window.