First, find a motivating factor. This can be intrinsic, or extrinsic. If you think of the course as boring you're apt to zone out. Take notes, interact with the teacher, and at all costs avoid distractions like your phone. Feel free to book a session to discuss the exact situation, and strategies that could help!