You're describing hyperfocus, which is a common manifestation of ADHD. ADHD is fundamentally the result of disordered executive functioning. That means someone with ADHD has difficulty controlling their attention. In some people, that means they bounce from thing to thing, in others that means they hyperfocus on certain things for too long losing track of other priorities like eating, sleeping, homework, etc. Failing to get enough sleep and exercise are particularly problematic since without those things executive function deteriorates further.