Disclaimer. This post describes a proof-of-concept experiment. It can damage your instrument(s). DO NOT replicate unless you fully understand all possible risks, both stated in this document and those not described. If in doubt, do not do it. I cannot be held responsible for any damage caused by attempting the theoretical procedure described below. That said, enjoy reading.
This post answers: "Can a NanoVNA (or a generic VNA) be used as a frequency counter?" Yes, with many quirks and don'ts! So, how?
Using both ports of the (Nano)VNA, we can see the transfer function of a device over a given range of frequencies. A signal is generated at Port 1, which we inject into the device under test, and we read the DUT output on Port 2. If DUT is a band-pass filter we should get the "hill" shape once we configure the VNA to display a trace in format "LINEAR".
In this configuration the VNA measures power at Port2 and shows the difference of Port2-Port1 versus frequency. So, if Port1 is terminated on the 50 ohm dummy load and we let Port2 pick whatever signal is coming from the air, the VNA almost becomes a spectrum analyzer. A pretty deaf one, but it sweeps over the set frequency range.
So, let's say you know more or less where your signal generator is (between 50 kHz and 300 MHz). You configure the VNA to display just one "LINEAR" trace and set the frequency range around the expected frequency. The displayed line should lay on the bottom of the screen because nothing is passing from Port1 to Port2. Now feed the unknown signal to Port2 (more later on how to do it): a peak will build on the line, and that's the frequency you are looking for. I suggest to zoom-in to get a more accurate measurement.
How to feed the signal to Port2? It depends on how powerful it is. My 5W HT could be picked without anything connected to Port2 at 1 metre distance. A weaker signal could be heard with a small wire acting like an antenna. A very weak signal could be fed through a pick-up loop. You would need to experiment and be careful not to fry your VNA input!
Or, better, get a frequency counter.