I second rumstscho's answer (except the part about ICD-10 being a major pain to use).
There is a classification system of medicines that is quite detailed and widely used, and it is called:
Anatomical Therapeutic Chemical (ATC) classification system
As you can guess from the name it classifies medicines based on:
- the organ or system on which they act and
- their therapeutic properties and
- pharmacological properties and
- chemical
How do they take all of these into account? By using a multilevel classification system. The classification is paired with a code system, which can be used to search for a medicine on a regulatory agency's website, for instance.
ATC classification system has five levels:
First level - anatomical main group (this is a level a layperson can easily understand)
A Alimentary tract and metabolism
B Blood and blood forming organs
C Cardiovascular system
D Dermatologicals
G Genito-urinary system and sex hormones
H Systemic hormonal preparations, excluding sex hormones and insulins
J Antiinfectives for systemic use
L Antineoplastic and immunomodulating agents
M Musculo-skeletal system
N Nervous system
P Antiparasitic products, insecticides and repellents
R Respiratory system
S Sensory organs
V Various
Second level - therapeutic main group (this is a level that an informed patient can understand - if you are somewhat familiar with the medical condition/indication the medicine is for, you can understand this level)
Third level - therapeutic/pharmacological subgroup (this is where things get quite technical; these waters are generally too deep for a layperson)
Fourth level - chemical/therapeutic/pharmacological subgroup
Fifth level - the chemical substance
How are medicines included in the system:
Inclusion and exclusion criteria
The WHO Collaborating Centre in Oslo establishes new entries in the ATC classification on requests from the users of the system. These include manufacturers, regulatory agencies and researchers. The coverage of the system is not comprehensive. A major reason why a substance is not included is that no request has been received. [...]
Complementary, homeopathic and herbal traditional medicinal products are in general not included in the ATC system.
from: WHO Collaborating Centre for Drug Statistics Methodology
(if you are really interested in this subject, you might find some chapters of this publication interesting.
However, there is no need for you to learn this (or any other classification). If your goal is to gain knowledge on medicines the area you are interested in is pharmacology or more precisely pharmacodynamics. This is quite a large area, but a real catch for a layperson is that it is an applied science, sou you would need knowledge from physiology, patophysiology and medicinal biochemistry first; and for those you would need cell biology, some anatomy and histology, microbiology, biochemistry (for which you definitely need some chemistry)... This would be a few year's quest and you would still need a curriculum and someone to supervise your learning process to make sure you understand all important concepts correctly.
This doesn't mean that you can't be a well informed, educated patient (or patient's caregiver, family member). You just don't need to learn about all of the major illnesses and medicines. Simply, when (if) a health problem occurs focus your efforts on that specific area. You cannot and should not use the knowledge you gain to self-medicate; it should serve you to communicate better with your health care providers, participate in the decisions, and if necessary consider if it's time to get a second opinion on something.
An aside: Here is an example of how a book in pharmacology is organised. The lessons about specific medicines start from section 2. You can see that sometimes a cellular/chemical mechanism is used (section 2), and sometimes a whole organ or system of organs (section 3 and 4) or the disease to be treated (section 5 and chapters 43-45 in section 4 e.g.) (whichever is better to explain how a certain medicine works). I do not recommend this book for you (not that it's not good, it's a great one) - because it's designed for grad students of medicine/pharmacy as well as phd students. While it is great because it encourages critical thinking, you can get lost in the quantity of details. I've just used its table of contents as an example how one can go about studying pharmacology. For a layperson I'd say that starting with Wikipedia is not a bad thing (articles there are usually well organised), as long as you make sure to check the accuracy of information you find there.