First, sessions and cURL are completely different and unrelated things. The session acts like a server side cache for the current user. cURL is a way of sending HTTP requests in PHP such as GET and POST. Some APIs require the use of cURL to interact with them from within your own PHP scripts/code.
The session_id() function is used to either get or set the current session id of the current user. If you want to set the session id to 7 for example, you would call
session_id(7);
session_start();
If you wanted to get the session id, you would call
session_start();
$CurrentSessID = session_id();
The session id is generated when you call session_start() unless you've set it yourself before session_start() is called.