The student would be LEARNING about religion, by their own choice
If religion was offered as an elective it would be completely up to the student. The school wouldn't be forcing the religion being taught upon anybody that did not chose to learn about it.