The question is how does the Priave Key Is generated and where it is stored ?
It all depends on which approach you had taken when generating your private key because, in some cases, like using offline methods to generate randomness, your keys don't touch the online environment at all and are stored nowhere except for physical media such as paper or metal. If, however, an insecure device connected to the Internet was used to make a private key, the information of this creation could be stored on your HDD or on some remote server controlled by a malicious actor.
If the private key is generated when your computer is online then it directly can go to the o blockchain Private Key database. And it is not impossible for hackers to find it by using some kind of hacking tools.
The bitcoin blockchain has no database containing private keys, and it even doesn't care if a certain address has a corresponding private key. It only cares about data structure being present in a correct format to track the chain of ownership changes. If some of the addresses representing ownership cannot be spent due to a lack of private keys, the blockchain simply keeps this data unchanged forever.
But how about offline btc transaction worked with your private key in you local network ? And how does it published latter in the Blockchain ?
You can sign transactions offline by attaching a cryptographic signature that can only be created with a private key. An offline transaction cannot be modified or altered by a malicious actor, but to make your transaction financially significant you first need to broadcast it using whatever method of transmitting data that is able to reach the nodes connected to the Internet and the bitcoin system. Once your transaction gets into a block and receives a sufficient number of confirmations, it becomes an immutable record of ownership transfer.