It has already been covered to some extent by previous replies, but I think it is worth stating more clearly that it is the code in the core that causes native USB Arduino boards to produce a USB CDC serial port while the sketch is running. That code is in the sketch program even when the .ino
file doesn't contain anything related to USB. This, in addition to experience with the non-native USB boards where the USB support truly is external, might give some users the impression that the creation of the port is done by something separate from the sketch (e.g., "the bootloader"). However, without the USB code from the core running in the sketch program, the board won't produce a port while the sketch is running.
For example, if you upload a sketch to a Leonardo that overrides the main
function in the core where the USB code is normally initialized, the board will not have a port:
// WARNING: this sketch will "soft brick" native USB Arduino boards.
int main() {
while(true) {}
return 0;
}
(unfortunately it is not possible to override the main
function from the sketch like this when using the UNO R4 Minima)
That USB code in the core also implements the recognition of the "touch" signal sent by the IDE at the start of an upload process, which causes that code to activate the bootloader. This is another thing that might be unexpected to those users who have more experience with the boards like the Uno, Nano, Mega that use an auto-reset circuit to activate the bootloader.