Why are there two different output voltage ratings on some power supplies? and How it works?
This adapter clearly states "Quick Charge".

To read more about QC, read here.

In short: this adapter supports a protocol called "Quick Charge" which
uses communication over the USB datalines to detect if a QC compatible product
is connected.

If a non-QC compatible product is connected, the adapter will output 5 V

If a QC compatible product is connected, the adapter will output 5 V until the product requests 9 V from the adapter. Only then will the adapter output 9V.