When the engine loads the map, it looks at each entity and spawns it - basically just like calling spawn(), which spawns a blank entity. Then it loads all the key/value pairs out of the map file, which includes classname (string field), origin, angles, etc. Then it searches for a QC function with the same name as the classname and calls it, with 'self' set to the newly spawned entity.
The QC spawn functions (e.g. monster_dog) are just regular functions that work with an entity (self) that has already been spawned, and has some fields already set (classname, origin, etc.)
edit:
Curse you Preach. Now my post is useless. I shall attempt to give it something worthwhile:
It's a frog.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.