We've been cutting open human bodies to see what's inside for thousands of years, and animal bodies before that. The art of determining the cause of death by autopsy came about long after the study of anatomy arose, and a rather famous murder gave us the earliest written account of an autopsy.
44 B.C. The first recorded autopsy occurs when Antistius examines Julius Caesar’s body after his assassination, determining which of the 23 stab wounds proved fatal. It was one wound to the chest that ruptured Caesar’s aorta.
A.D. 131–201 Galen of Pergamon is the first person to correlate a patient’s symptoms with what was found upon examining the affected area of the deceased. He produces a large amount of written text about the human body—his meticulous masterpiece is titled On the Usefulness of the Parts of the Body—though his writings were based on the inaccurate humoral theory.
So you see that the autopsy preceded most of our understanding of physiology. It was a long trek from Julius Caesar to the hi-tech examinations that can solve mysterious deaths today -when the money and expertise are available. Read an extensive history of the autopsy at Popular Mechanics.