The warning buzzer circuit closes (ie activates buzzer) when there is insufficient oil pressure to open the oil pressure warning switch, or when the temperature sender overheats and closes the circuit.
When you turn the key on, but the engine is off you have zero oil pressure. The circuit is energized when you turn the key on, but stays closed because the oil pressure switch is closed. Therefore it will buzz until the engine starts and builds oil pressure, opening the oil pressure switch, therefore opening the buzzer circuit. If the engine is running and overheats or loses oil pressure, the respective sender closes the circuit and activates the buzzer.
If the buzzer stays on constantly right after the engine starts, you either have
1. faulty oil pressure switch or faulty temperature sending unit or wiring issue with either/or.
2. oil pressure problem.
If the buzzer comes on when you turn on the key, but turns off when the engine starts up then thats perfectly normal. When you shut the engine down the buzzer will come back on again until you turn off the key.