Sometimes it is just a wind causing noises inside the chimney / vent pipe. There’s also a piece of metal (baffle) hanging inside the water heater, a few inches below the spot where the vent pipe starts.
This piece of metal expands when exposed to heat from the WH burning chamber and contracts when the burner goes off. This occasionally creates scratching noises as well.
The vent pipe from your water heater might continue through the roof as a single pipe / nothing else connected to it. It may also be a short connector between the water heater and a chimney serving other appliances as well, there are a few possibilities.
Open gap above the water heater and the top of the chimney are the only ways out if you have a single vent pipe / chimney, there might be more “escape” ways if there are other appliances connected to the same chimney.
If there’s something inside, a bird or rodent that has accidently fallen into the flue pipe… I don’t think it will be able to climb up the flue / it needs to be removed. I’ve also seen small birds at the bottom of the water heater’s burner chamber because once inside the chimney they get poisoned with Carbon Monoxide and fall through the center hole of the WH tank.
To prevent it from ever happening again (if this is the case) you have to make sure that there’s a protective screen and a cap on top of the chimney.
You can call a plumber, chimney sweep company, or a heating contractor for help (first two are probably the best choice).