To a scientist, a theory is the opposite of a hunch
In daily speech, a theory is a hunch. In science it means nearly the opposite: a well-confirmed explanation of nature, the most rigorous and reliable form of scientific knowledge. The untested guess is properly called a hypothesis. The word's own history runs from Greek spectators to Pythagoras.
Broadly, a theory is any organised set of ideas about something, reached by reasoning of any kind. That covers everyday guesses about why a friend acts oddly, philosophical accounts of politics or reality, and scientific explanations. Theories are not all equal; they can be ranked by how well they explain what they set out to explain and how strong the evidence for and against them is.
Science uses the word narrowly. A scientific theory must be framed so that tests could support it or falsify it, and it must meet the standards of the scientific method. It sits apart from a hypothesis, a single testable conjecture, and from a scientific law, which is a descriptive account of what nature does under particular conditions. Theories aim at finding out what is the case, not at reaching goals, and stay neutral between competing values.
Outside science, theory is usually set against practice, from the Greek praxis, doing. Medicine is the textbook example. Medical theory tries to understand what causes health and illness; medical practice tries to make patients well. The two connect but can run separately, since you can study disease without treating anyone, and cure someone without knowing why the cure worked. Aristotle framed the contrast: both involve thinking, but theoretical contemplation studies things humans do not change, such as nature, while praxis always aims at some action people choose to take.
The Greek theoria originally meant looking at or beholding, and it came to describe the speculative understanding of natural philosophers, as opposed to the know-how of orators and craftsmen. The classicist Francis Cornford suggested the Orphics used it for passionate, sympathetic contemplation. Pythagoras reversed the emotional charge, making it the cool contemplation of unchanging mathematical truth, reached by subduing bodily desires. That shift planted the idea of theory as detached, neutral thinking. English speakers have used the word since at least the late 16th century.
Source: Theory