You're already using "ao" to say at the or, to the, but it has another entirely different meaning when used together with a verb in the infinitive. When I first started hearing people say this I didn't even notice t since it's just an "ow" before of a verb. I thought it was some weird slang.
So to say for example, upon arriving... it's: ao chegar...
This is very cool! Let's see some examples:
Upon opening the box it was obvious that it was something fragile.
Upon finding out that she was married, he took off (went away).
Upon seeing the mess he made, I decided to call for some professional help.
Upon hearing that story, I swore-off alcohol.
Upon turning the corner, she looked over her shoulder and saw her friend walking.
Upon seeing them together, he knew it was over.
Upon becoming a young man, he already had an arrest record.
*Notice that in English we can say either upon arriving or, upon arrival. I have no idea why. In Portuguese these both translate as ao chegar.
Upon arriving home, I noticed that all the lights were on.
Upon arrival, we went straight to the airline gate.
You can also use ao to say at like this:
Mas aos 5 anos nós viemos para cá. (at five years of age...)
From the video learning course, INTENSIVO.