Subject is the theme, maybe it is a topic discussed in the course or something.
Lesson refers to a certain class. I feel that when I use this word, the class is usually dominated by professors teaching knowledge.
Class refers to a class, which can be a lecture, a discussion or other forms.
In fact, I think there is no strict distinction between course, lesson, class, and most of the cases can be mixed.