Born in Marseille, Hernandez joined Atlético Madrid’s academy in 2007, aged 9. After progressing through the youth categories, he was promoted to the reserves in Tercera División in summer 2015.
On 3 February 2016, Hernandez renewed his contract. Two days later, he was called up to the first team for a La Liga match against SD Eibar due to injuries, but remained an unused substitute in the 3–1 home win.
On 4 August 2016, Hernandez extended his contract until 2021, being immediately loaned to fellow league club Deportivo Alavés for one year. He made his professional debut late in the month, starting in a 0–0 home draw against Sporting de Gijón.
On 16 October 2016, Hernandez was given a straight red card in a 1–1 home draw to Málaga CF after a hard tackle on Ignacio Camacho. He scored his first professional goal the following 7 May, netting the game’s only in a home success over Athletic Bilbao.
A regular starter during the Basque team’s run in the Copa del Rey, Hernandez helped them reach the final for the first time in their 91-year history. During the decisive match on 27 May 2017, he scored the equaliser through a direct free kick in a 1–3 loss against FC Barcelona.
On 5 July 2017, Hernandez signed a six-year deal with Real Madrid after they met his release clause of €24 million. He made his competitive debut on 16 August, replacing Marco Asensio in a 2–0 home win against Barcelona for that year’s Supercopa de España.
Hernandez made three appearances during the 2017–18 edition of the UEFA Champions League, helping the club win its third consecutive and 13th overall title in the competition. On 10 August 2018, he was loaned to Real Sociedad.