The design of airplanes or any wing-like applications involves shape optimization to maximize energy harvesting from a flow. Nevertheless, the final design must reach a compromise for several operating conditions. Morphing structures adapt their shape as a function of the environment and offer a broader range of optimal performances. Recent advances in the different fields of fluid-structure interaction have confirmed the feasibility of smart morphing wings. From the structural point of view, novel materials have opened the path towards flexible wings able to bear high loads. On the control and real-time optimization side, several machine learning methods have been shown to outperform other model-based methods. The final bottleneck towards the application of these technologies is thus the lack of numerical tools to test optimal morphing strategies, and an adequate optimization framework to learn these by imitating natural flyers. This thesis aims at bridging this gap, building on three main pillars: the development of the deformable overset meshing method, the definition of physics-based surrogate modeling for Micro Air Vehicles (MAV) aerodynamics, and the development of a bio-inspired optimizer. While the focus is kept on bio-inspired MAVs, the proposed methodology can find application in any aerodynamic applications involving the control of deforming bodies in motion.