I will review recent results pertaining to nonlinear optical effects in bulk and nanostructured two-dimensional (2D) materials. I will start with a brief introduction of some theoretical concepts and numerical methods widely used in the study of optical properties of periodic structures and photonic devices, such as metamaterials, diffractive optical elements, and plasmonic structures. In particular, I will explain how the mathematical formulation of these methods can be extended to incorporate quadratic and cubic nonlinear optical effects, a key feature that makes these methods powerful tools for the exploration of nonlinear optical effects at the nanoscale. In the second part of the talk I will illustrate how these tools can be used to design nonlinear photonic devices with new functionalities and explore new, intriguing nonlinear optical effects at deep subwavelength scale. To this end, I will demonstrate enhanced nonlinear optical interactions in periodically patterned photonic nanostructures via resonant excitation of nonlinear waveguide modes, enhanced nonlinearity of nanostructures containing graphene and other 2D nanomaterials (MoS2, WSe2), and tunable Fano resonances for increasing the nonlinear efficiency of hybrid 2D-3D photonic heteromaterials.