Previous studies on Course Recommendation (CR) mainly focus on investigating the sequential relationships among courses (RNN is applied) and fail to learn the similarity relationships among learners. Moreover, existing RNN-based methods can only model courses’ short-term sequential patterns due to the inherent shortcomings of RNNs. In light of the above issues, we develop a hyperedge-based graph neural network, namely HGNN, for CR. Specifically, (1) to model the relationships among learners, we treat learners (i.e., hyperedges) as the sets of courses in a hypergraph, and convert the task of learning learners’ representations to induce the embeddings for hyperedges, where a hyperedge-based graph attention network is further proposed. (2) To simultaneously consider courses’ long-term and short-term sequential relationships, we first construct a course sequential graph across learners, and learn courses’ representations via a modified graph attention network. Then, we feed the learned representations into a GRU-based sequence encoder to infer their short-term patterns, and deem the last hidden state as the learned sequence-level learner embedding. After that, we obtain the learners’ final representations by a product pooling operation to retain features from different latent spaces, and optimize a cross-entropy loss to make recommendations. To evaluate our proposed solution HGNN, we conduct extensive experiments on two real-world datasets, XuetangX and MovieLens. We conduct experiments on MovieLens to prove the extensibility of our solution on other collections. From the experimental results, we can find that HGNN evidently outperforms other recent CR methods on both datasets, achieving 11.96% on P@20, 16.01% on NDCG@20, and 27.62% on MRR@20 on XuetangX, demonstrating the effectiveness of studying CR in a hypergraph, and the importance of considering both long-term and short-term sequential patterns of courses.