The sensors in Star Trek have been shown to be very sophisticated. We also know that they have something similar to neural networks, computer programs which are capable of 'learning' and making conclusions on new data based on existing samples.
With a few notable exceptions, biological sex is pretty binary in Star Trek, including among alien races, even those in the distant Delta Quadrant. It's not unreasonable that the sensors are able to distinguish biological sex of a life sign, or at least make a best guess (new conclusion), based on known sensor data (existing samples of life signs) in comparison.
In fact, sensors have been shown to be capable of distinguishing biological sex in the past, in the Voyager episode "Basics" (Hat-tip):
KIM: Showing one life sign, adult Kazon male. He's in critical condition.
There is also the Next Generation episode, The Chase, which demonstrates a common ancestor between multiple species in the Milky Way and why they have so many common characteristics, including sex.
As for identified gender, it is unlikely the sensors could determine that. They are simply making a "best guess", either arbitrarily, or based on their sensor data.
It's also possible they simply chose a pronoun arbitrarily out of convenience, until being corrected by said life form. For what it's worth, their guess on both biological sex and gender does turn out to be correct. Out of universe, the writers already know the character is male - so they simply slipped in the pronoun in advance, in a foreshadowing-esque way.
As for "how did Tom get the info", it seems likely that all consoles (bridge consoles at least) are capable of receiving sensor data - at least when the plot requires it. That's not to say that all officers are reviewing the sensor data at any given time. But Tom, as the pilot, would certainly have info about the life signs on his console, as he may need to navigate towards them.