I present the results of first principles calculations of the electronic structure and magnetic interactions for the recently discovered superconductor YFe$_2$Ge$_2$ and use them to identify the nature of superconductivity and quantum criticality in this compound. I find that the Fe $3d$ derived states near the Fermi level show a rich structure with the presence of both linearly dispersive and heavy bands. The Fermi surface exhibits nesting between hole and electron sheets that manifests as a peak in the susceptibility at $(1/2,1/2)$. I propose that the superconductivity in this compound is mediated by antiferromagnetic spin fluctuations associated with this peak resulting in a $s_\pm$ state similar to the previously discovered iron-based superconductors. I also find that various magnetic orderings are almost degenerate in energy, which indicates that the proximity to quantum criticality is due to competing magnetic interactions.