A pilot is someone who takes direct part in flying an aircraft by manipulating flight controls.
A captain is a person who can (in the sense of is capable of and legally permitted to) act as a pilot, and who has been hired or promoted by their employer to the rank of captain. They are normally the highest-ranking working employee of the operator aboard the airplane, though exceptions exist. They can typically be recognized by having four gold bars on their shirt shoulders.
A first officer is a person who can (in the sense of is capable of and legally permitted to) act as a pilot, and who has been hired or promoted by their employer to the rank of first officer. It is the rank below captain. They can typically be recognized by having three gold bars on their shirt shoulders.
As already stated, the term co-pilot isn't widely (if at all) used in commercial aviation. Both pilots in the cockpit of a modern airliner are fully qualified pilots, and the terminology has been changed to reflect this fact.
Older airplanes typically had a flight engineer in the cockpit as well; this is a flight crew position, but it is a person that does not directly take part in directing the path of the airplane (it is a non-flying flight crew position). Older yet, they also had a separate position for a navigator, who would tell the pilots where to go. In modern airliners, both of these positions have been replaced by computers.
To answer what you didn't ask, there is another three important terms to know: Pilot Flying, Pilot Monitoring and Pilot In Command.
The Pilot Flying is the pilot that is directly operating the airplane by making control inputs to control the direction in which the airplane is going.
The Pilot Monitoring (or Pilot Not Flying) is the pilot that is keeping an eye on the Pilot Flying, and looking at the instruments, to make sure that the flight is proceeding safely. They will also usually do things at the request of the Pilot Flying. For example, the Pilot Flying may call out for a specific flap setting, or for the landing gear to be raised or lowered, or something similar; the Pilot Monitoring would usually be the one making those airplane configuration changes. The Pilot Monitoring may also be handling radio communications with Air Traffic Control.
Pilots will typically alternate who acts as Pilot Flying and who acts as Pilot Monitoring. This can even change at a moment's notice in the middle of the flight, but there will always be one pilot acting as Pilot Flying and one pilot acting as Pilot Monitoring, and there will always be a clear understanding among all involved who is acting in which role. Accidents have happened when it was not clear in the cockpit who was acting as Pilot Flying and who was Pilot Monitoring, or when the roles became intermingled by one pilot acting in parts of both roles.
The Pilot In Command is the person who is ultimately responsible for the safety of the flight. They can be regarded as the boss in the cockpit, but thanks to the advent of Cockpit Resource Management (CRM), reality is that they are more of a leader than a boss. A good pilot, whether or not they are PIC, will seek the input of their colleagues as much as possible. The PIC will typically be a captain. There is no requirement that at any given time the Pilot In Command is the Pilot Flying. (Some operators may however require in their operational procedures that, say, the PIC, or a captain, is the one performing certain maneuvers, and some aircraft may not be equipped to perform all maneuvers from either seat.)
With these (rough) definitions, we can see that there is no necessary contradiction in something like a flight crew consisting of multiple captains (with a clear understanding of who is Pilot Flying and who is Pilot Monitoring, as well as who is Pilot In Command); or a person who is a captain acting as Pilot Monitoring while another person in the cockpit (or possibly even not in the cockpit) is Pilot In Command, and quite possibly a person who is a first officer acting as Pilot Flying.