I've got an auxiliary building that I use as my workshop. Someday when I retire we'll convert it to ADU for us and rent the main house, or visa versa.
That said, Portland seems to have a no harm / no foul attitude towards them. The town needs rental space, so they tend look the other way, in spite of the nebulous legality of them. Meaning, depending on your neighborhood, if your zoning is R1, you're only allowed one building as living space per lot. Even a basement apartment is not allowed a full kitchen. Technically.... A second story on a garage will attract attention on a couple of different levels - building code, fire code, zoning, etc. Trickier to build all the way 'round.
A new separate building (like my shop) will have to fit all the code requirements (setbacks, building codes etc). If you go that route my suggestion is to only permit the empty shell with no plumbing and base electrical. Then after it's signed off install the kitchen / bathroom, etc.
As for cost of a new building, it largely depends on how difficult the utilities runs are, and if it needs a sewage pump (mine will). My shop is a
Tuff Shed building. If I was doing it again I probably would have gone a different route. They have cost calculators on their website that will give you a pretty good idea of the raw structure.
Basement retrofits can be equally expensive depending on the layout and age of the house. Emergency egress can be had with a window well style window. I can't remember the specs on height, but as my aging memory serves it needs to be a minimum of 30" wide and 4' tall.
I know a couple of excellent contractors in the area if you need one, and you're welcome to see my shop if that's of interest.
WAG on $? If it's a 400 s.f. building or so with bathroom and kitchenette I'll guess $30k. Roughly the same for a basement unit if you have to cut into the concrete floor for plumbing.
-C