It is most likely the EVAP system doing its thing as Arthur posted. I have a new 2021 Crosstrek Sport and walked into the garage one day and heard the noise from under the rear of the car. I immediately thought, "oh no, what is wrong with this thing, I sure don't want to have to take it back to the dealer". Fortunately, there is at least one other thread on this forum that discusses what is going on. It will turn off by itself, but like you when I heard it I got in it, turned on the ignition and it stopped.
There is even information about it on page 9 of the owners manual:
"Noise from under the vehicle
You may hear a noise from under the
vehicle approximately 5 to 10 hours after the ignition switch is turned to the
“LOCK”/“OFF” position. However, this does not indicate a malfunction. This
noise is caused by the operation of the fuel evaporation leakage checking system
and the operation is normal. The noise will stop after approximately 15