Typically a similar computer system would internally generate all system and video clocks it needs to operate from a single clock source, like a crystal oscillator on a motherboard.
Thus the system would only be able to free-run asynchronously and without any possibility to be adjusted to run synchronously with another system.
The Amiga simply added two features to enable genlocking. It is possible to (1) use an external clock source as the system clock and to (2) switch the video chip horizontal and vertical sync pins to inputs so they can come from external source instead of internal system clock based sync generator.
Selecting an external clock source is made very easy. The video connector has one input pin (XCLK) for feeding in the external system clock signal, and another input pin (XCLKSEL) to select if the internal crystal oscillator clock or the externally fed clock will be used as the system clock, default selection being the internal crystal.
The external clock needs to have approximately the same frequency than the internal clock (e.g. 28.636363 MHz for NTSC Amiga), which can be adjusted up or down within some small tolerance (e.g. 1% to 2%), to allow the Amiga video horizontal rate to exactly match with the external video horizontal rate.
This by itself is enough to make the system to run at the same rate than an external system.
If the external system would simply adjust the external clock so that Amiga output horizontal sync matches with the horizontal sync of the external system, it could take a long time for the hsync phases to get aligned as the system clock needs to be tuned only very slowly.
It would take even longer to adjust Amiga vertical sync output to align with the vertical sync of the external video, assuming that it is even possible to align them, as the external video might have different parameters than the Amiga internal video sync generator. The external video could have some tolerance in the amount of horizontal lines or simply be interlaced or progressive.
That is why the Amiga video chip has a software controllable bit (ERSY in BPLCON0 register) to switch both the HSYNC and VSYNC pins to inputs, so that a device on the video connector can drive the sync signals into video chip which can then generate video according to external sync signals.
This way the video chip can be kept locked well to external video signals.
The actual magic of genlocking happens externally to the Amiga, in the genlock hardware connected to the video port. A genlock would have a sync extractor to produce the required seprarate HSYNC and VSYNC from the incoming video signal to video chip, and a PLL to multiply the HSYNC frequency by 1820 (NTSC) to produce a system clock that is aligned to have the exact same HSYNC to system clock relationship as the internal sync generator would have.
Now that the Amiga has been gotten genlocked with incoming video signal, and so it is in sync with all other devices for example in a TV studio, what happens next is up to any the external hardware connected to the Amiga. The Amiga itself will keep transmitting video as usual, and does not care how the video is used.
So in a TV studio setting, it can be used just like any other video source, mixing it with TV camera signals for example, or do any other processing - it depends on external equipment.
However, a typical Amiga genlock device simply allows to overlay Amiga generated graphics on top of existing video signal coming from some source, like VCR or camera.
This is possible, because the Amiga video chip outputs a signal named PIXLSW to the video connector for the genlock device to use. The signal simply indicates if the current pixel is the background color or something else. It means that the video output on the genlock device can be switched between original input video signal, or have it replaced by Amiga generated video signal. Background color will switch to original video, and any non-background pixels will replace original video. So basically the PIXLSW signal can be used as a mask to know what to pass through or replace.