normaly you need esd proctedtion and serial terminal resistor to get a clean usb connection.
I have done sucessull USB wiring on a nucleo wiht only resistor (see any eval baord schematic for detauls).
I’m not sure to ge the issue but if you’r code and wring is correct pluging the device to some host it shall appear .
On windows it will show as unkown device and if you install ST VCP driver its will appear as a “COM” port
if you plug it to a linux hots it will apear as an usb cdc/ascm tty usable out of the box.