Twisted 2D materials present an enticing platform for exploring diverse electronic properties owning to the tunability of their bandgap energy. However, the intricate relationship between local heterostrain fields, thickness, and bandgap energy remains insufficiently understood, particularly at the nanoscale. Here, it presents a comprehensive nanoscale study elucidating the remarkable sensitivity of the bandgap energy to both thickness and heterostrain fields within twisted WS2 nanostructures. This approach integrates electron energy-loss spectroscopy (EELS) enhanced by machine learning with 4D scanning transmission electron microscopy (STEM). Through this synergistic methodology, enhancements up to 20% in the bandgap energy is unveiled depending on the specimen thickness. This phenomenon is traced back to sizable deformation angles present within individual layers, which can be directly linked to distinct variations in local heterostrain fields. The findings represent a significant advancement in comprehending the electronic behavior of twisted 2D materials and introduce a novel methodological framework with far-reaching implications for twistronics and the investigation of other materials within the nanoscience domain.