PaintBox1Paint is the handler for the OnPaint event of the paintbox. TPaintbox is very "stupid", it has no built-in way how to react when the OS requests it to repaint itself. Therefore the user must provide a handler for the OnPaint event which is executed in this case. When the form ist shown for the first time, the paintbox is requested to draw itself - and thus executes the user's OnPaint code.
When you put your drawing code in the OnClick event of a button it could be that the drawing appears in the paintbox, at least on Windows, but it will not be persistent: Drag the form partly out of the screen and then back into the screen again, and you'll see that part of the drawing is erased. This is because the paintbox does not know how to redraw itself if OnPaint is empty - the button's OnClick code is unreachable for the paintbox.
The button's OnClick code is correct only when it draws into a bitmap (similar to what you do with BGRABitmap, but a standard TBitmap will work as well) which is displayed in a TImage. A TImage by default "knows" how to redraw itself - namely to draw the bitmap assigned to it. Unlike a TPaintbox where you would need an OnPaint handler again to draw the bitmap on the control.
In order to assign code to the OnPaint event (or any other event) double-click on the event in the object inspector. The IDE creates an empty procedure skeleton for you in the code editor which you must complete with your own code.