Contextuality is considered as an intrinsic signature of nonclassicality and a crucial resource for achieving unique advantages of quantum information processing. However, recently, there have been debates on whether classical fields may also demonstrate contextuality. Here, we experimentally configure a contextuality test for optical fields, adopting various definitions of measurement events, and analyze how the definitions affect the emergence of nonclassical correlations. The heralded single-photon state, which is a typical nonclassical light field, manifests contextuality in our setup; whereas contextuality for classical coherent fields strongly depends on the specific definition of measurement events, which is equivalent to filtering the nonclassical component of the input state. Our results highlight the importance of the definition of measurement events to demonstrate contextuality, and they link the contextual correlations to nonclassicality defined by quasiprobabilities in phase space.