I started flying with VATSIM and but I couldn’t find a proper answer to this question online. Who defines a callsign for a plane in a given flight? Is a callsign set to a airplane? Is it related to the letters on the fuselage?
The proper procedures for use of aircraft call signs with ATC in the U.S. are spelled out in the FAA Aeronautical Information Manual (AIM).
For Commercial flights the call sign is usually preceded by the company name (e.g., "United two-seventy five"). The last digits (e.g., "two seventy five" ) are associated with the city pairs/route that the aircraft is flying. Flight numbers are internally derived by the carrier based on its needs for publishing/tracking/scheduling. So, for example, a particular company's flight from SFO to DFW that operates 7 days a week at the same time normally would always carry the same flight number (such as UAL 527 [ I just made up this number for illustration purposes]).
With respect to proper radio communication techniques:
Under normal circumstances (for non-commerical civil aircraft in USA), on initial contact with ATC pilots should state the aircraft's full call sign. For example - "November 12345" or "Cessna 12345." After initially establishing communication with that ATC facility, during subsequent transmissions, the pilot may abbreviate the call sign by using the "prefix" (i.e., "Cessna") and the last 3 digits or letters (i.e., "345") such as "Cessna 345."
It is never appropriate to not include the "prefix" (i.e., "Cessna" or "November") and only use the last 3 digits/letters (i.e., "345").
"VATSIM is the Virtual Air Traffic Simulation network, connecting people from around the world flying online or acting as virtual Air Traffic Controllers." In small GA planes, call sign is the tail number of the plane, often combined with airplane type. Ex: N12345, Cessna Cardinal, then Cardinal 12345 after comms are established. Then often shortened to just 345 when acknowledging an ATC request such as a frequency change if a similar tail number is not on the air at the same time. For airlines, see other replies.