講堂へ / に講義に行く also means "I go to give a lecture". 講堂へ / に受講に行く / 受講しに行く is used for "I go to hear a lecture". 講堂での講義に行く can mean both "to give a lecture" and "to hear a lecture", though.
The key is what the part of speech of the word preceding に is, not the meaning of it. See the followng examples.
パリにフランス語の勉強に行く。
パリにフランス語を勉強しに行く。
In the former example, 勉強 is a noun, therefore the possession の is used. On the other hand, を is used in the latter case since 勉強し is the -masu stem of a verb 勉強する. The meaning is the same in either case.