They’re specific chemicals that can exist as gases or aerosols. Something emits these particles and they gradually get diffused (mixed) into the air.
Your nose can detect these chemicals and presents them to your brain as “smell.” In fact, the “flavor” of food is also just the smell, except it works backward. When food or drink is in your mouth, the flavor compounds get aerosolized (it’s why chewing makes things taste stronger) and when you exhale, they pass through your nose for detection.
The reason why smells go away after some time is usually because they diffuse to a point where they’re not detectable, or because your brain puts them in the background as you’re not actively needing the input.