Because the opposite of reaction is also happening
For reaction element to ion
Na -> Na^+1 + e (faster so more reactive)
H -> H^+1 +e
In electrolysis ion to element
Na^+1 +e -> Na
H^+1 +e -> H (faster so reaches cathode first)
Sodium is more reactive as it can lose electron faster than hydrogen to become ions
So in electrolysis,hydrogen can take electrons faster to become element from ions.
First point of marks is about element->ion
Second is ion->element
(You have misconceptions over here)
Sodium can easily turn to ion but it gets harder for it to become element again compare to hydrogen.So hydrogen reaches cathode as it easier for it to become element