We demonstrate photon-mediated interactions between two individually trapped atoms coupled to a nanophotonic cavity. Specifically, we observe superradiant line broadening when the atoms are resonant with the cavity, and level repulsion when the cavity is coupled to the atoms in the dispersive regime. Our approach makes use of individual control over the internal states of the atoms, their position with respect to the cavity mode, as well as the light shifts to tune atomic transitions individually, allowing us to directly observe the anti-crossing of the superradiant and subradiant two-atom states. These observations open the door for realizing quantum networks and studying quantum many-body physics based on atom arrays coupled to nanophotonic devices. arXiv:1909.09108v1 [quant-ph]