Considering the example of an application or process that needs to send a particular request to a given server. How does the application initiate the process of creating the packet containing the request it wants to send, and what parties are involved in this process?
Given that you tag your question with "TCP": Usually the application just sends the data to the OS kernel using
send or similar system calls. Delivering the data including putting the data into packets are done by the OS. The rare exceptions to this are user space TCP/IP stacks.
Note that TCP is only a byte stream and has no message semantics. Any message semantics (like request, response) are only at the application level. There is no guaranteed 1:1 relation between a single
send and a packet on the wire, i.e. the OS is free to split a single
send over multiple packets, combine multiple
send in a single packet etc.