Welcome to Flyer Talk
mak
It sounds like you're using the online booking tool? This searches for "ideal" connections and I'd guess the long transit for HAN-NRT-MEX is longer than they've programmed for when shorter connections exist. Simply enter as 2 legs HAN-NRT and NRT-MEX separately to get the connection.
You can do what you like between the 2 flights (assuming able to enter Japan). Either go through transit security and remain airside at the airport, or leave and explore either Narita or Tokyo for the day.