Residency is training that you undergo after completion of medical school. While medical school teaches the foundations of medicine and exposes you briefly to the different specialties, residency is spent learning the skill set particular to a given specialty. As a resident you you are already a docotr (MD) and thus take care of patients, however you do this under the supervision of more senior residnets and attendings (those who have already finished residency). Some residencies available upon graduation from med school include: Anesthesiology, Internal Medicine, Pediatrics, Surgery, Ob/Gyn, Radiology, Psychology, Orthopedic Surgery, Neurological Surgery, Urology, Otolaryngology, Ophthalmology, Dermatology, Plastic Surgery, Neurology, Physical Medicine and Rehab, etc.
Fellowship is training you undergo upon completion of residency if you want to sub-specialize in a field. A fellow is somewhere in between a resident and an attending in terms of their knowledge, skills and responcibility. So after completing a General Surgery residency one may choose to do a fellowship in fields such as Pediatric Surgery, Cardiothoracic Surgery, Transplants, Colorectal, Minimaly invasive, Trauma, etc. After completing an Internal Medicine residency one may choose to do a fellowship in fields such as Cardiology, Gastroenterology, Infectious Disease, Pulmonology, Endocrinology, etc.
So if you wanted to be a cardiac surgeron you would have to complete medical school, then complete a general surgery residency, then complete a cardio-thoracic fellowship. After having done that you can choose (depending on where you practice) to do mostly mitral valve replacements or mostly CABG. That part gets a little more tricky b/c it depends on the place where you work, the other surgeons there, the patient population, and many other factors. You are qualified to do any and all of those procedures, however, after completing your CT fellowship.