The modern harvard-architecture MCU uses onboard flash memory to store firmware, so even though it's called ROM, it's not really read-only. According to the 8051's Wikipedia article, the modern 8051-based microcontroller often includes:
built-in reset timers with brown-out detection, on-chip oscillators, self-programmable Flash ROM program memory, bootloader code in ROM, EEPROM non-volatile data storage, I²C, SPI, and USB host interfaces, CAN or LIN bus, PWM generators, analog comparators, A/D and D/A converters, RTCs, extra counters and timers, in-circuit debugging facilities, more interrupt sources, and extra power saving modes.
The 8051 also has an onboard UART providing the serial port. It's been a while since I worked with embedded devices, but here's what I remember -- I worked with PIC microprocessors so this might not be exactly the way your 8051 does it:
- On bootup, the MCU loads bootloader code from a particular ROM location.
- Many common bootloaders will wait a few seconds, checking the serial port for a particular signal.
- If you've attached the debug board to your computer's serial port, you can send that signal (with a terminal program like Hyperterm or Minicom, or with a special-purpose firmware loading program).
- On receiving that signal, the MCU's bootloader code puts the board into programming mode, and you can send over the new firmware.
- If the MCU doesn't get the signal, it continues booting normally into whatever firmware is already loaded in the program memory.
"Programming mode" on some microcontrollers involves using higher voltages to program EEPROM memory, but not all microcontrollers require this.
For specific details, you should refer to your MCU's datasheet (generally available from the manufacturer's website). The Stack Exchange site ChipHacker is dedicated to DIY embedded electronics and is a good place for further questions.