This diagram would be easier for you to conceptualize if you instead used the actual nucleotides in the restriction sites and green GGAGAA region along with your gene of interest (GOI). I recommend working with the DNA sequences when learning about primer design for various applications. I believe it has led you to be slightly confused with what is the restriction site and what is not in this diagram so I'll walk through it.
At the first step shown, you have your annealing region of the forward and reverse primers binding to the GOI. The overhanging region on each primer contain your restriction sites, which are flanked by the GGAGAA region for these restriction enzymes to have a sequence to "grab on" when you perform a restriction enzyme digest. Note that the annealing region of your primer anneals to the GOI because it has homology to the DNA sequence. Your restriction sites and green "clamping" region do not have homology to your DNA template so they are considered the overhanging regions. It is important to have your annealing regions of both primers of similar annealing temperatures when designing this or you may not have an efficient PCR reaction. I typically use this tool from NEB to design annealing regions of my primers. https://tmcalculator.neb.com/#!/main
Moving forward, these primers are both going to be used in one PCR reaction, not separate. Thus, when the reaction begins, the double stranded DNA template will denature, giving your forward and reverse primers the opportunity to anneal during the annealing phase of a PCR reaction. During the elongation phase, your DNA Polymerase will add complementary nucleotides in the 3' direction of your primers. Now after the first cycle, you have two different products. The forward primer's product has the GOI with a single stranded BamHI overhang on the 5' end, while the reverse primer's product has the GOI with a single stranded NotI overhang on the 5' end.
During the second cycle, after denaturation, the reverse primer with a NotI overhang anneals to the forward primer's previous product with a BamHI overhang. The DNA polymerase then adds nucleotides in the 3' direction of the primer, eventually adding complementary bases to the BamHI overhang. The same is done vice versa with the forward primer and the reverse primer's previous product.
Now after the second cycle, you have the desired products which will be amplified exponentially. Your GOI flanked by NotI and BamHI restriction sites with the GGAGAA region on both sides. This product is ready for a restriction enzyme digest.