Is this possible. For instance can I publish a library called X and a Library called Y to a database called XY_Table?
No, you'd better have two dbs and integrate them using some etl tool.
Cognos wipes out db before publishing and if you can cope with that, you'd get dimension tables name conflict for sure.