The identification of genes and pathways responsible for the transformation of normal cellsinto malignant ones represents a pivotal step to understand the aetiology of cancer, to characterise progression and relapse, and to ultimately design targeted therapies. The advent of high-throughput omic technologies has enabled the discovery of a significant number of cancer driver genes, but recent genomic studies have shown these to be only necessary but not sufficient to trigger tumorigenesis. Since most biological processes are the results of the interaction of multiple genes, it is then conceivable that tumorigenesis is likely the result of the action of networks of cancer driver and non-driver genes. Here we take advantage of recent advances in graph neural networks, combined with well established statistical models of network structure, to build a new model, called Stochastic Block Model Graph Neural Network (SBM-GNN), which predicts cancer driver genes and cancer mediating pathways directly from high-throughput omic experiments. Experimental analysis of synthetic datasets showed that our model can correctly predict genes associated with cancer and recover relevant pathways, while outperforming other state-of-the-art methods. Finally, we used SBM-GNN to perform a pan-cancer analysis, where we found genes and pathways directly involved with the hallmarks of cancer controlling genome stability, apoptosis, immune response, and metabolism.