This question really touches on what the purpose of the Tree of Knowledge was. Why would G-d not want them to eat from a Tree of Knowledge of Good and Evil? Isn't that the most important knowledge to have?
In Moreh Nevuchim 1:1 Rambam develops an approach to understanding this (in which he alludes to your question). As I understand his answer, it is basically the following:
Before eating from the Tree of Knowledge, Adam understood moral truths as just that - truths. Just like 1 + 1 = 2 is immutable and is not subject to how you feel about it or any weighing of values, so to "do not disobey G-d" was not a question of right and wrong, it was a question of true and false. "Obey G-d" was a truth. It was objectively grasped by his intellect. In the Rambam's example, it would be silly to apply "good" or "bad" to the statement "the Earth is flat." The intellect differentiates between those. When they ate from the Tree, they chose to allow subjective passions to affect their decisions. This lowered them from their lofty intellectual state of being into a state of being which involved moral decisions, as they had to battle their passions. Their framework shifted from אמת ושקר, true and false, to טוב ורע, good and evil.
So to answer your question, they knew much more than good and bad before they ate - they knew moral decisions as truths. When they ate from the tree, their mode of knowledge shifted - now they knew good and bad, as opposed to true and false. Thus, it is the Tree of Knowledge of Good and Evil, not simply the Tree of Knowledge - it brought a very specific type of knowledge.
Addendum:
As to why they sinned, the Rambam addresses this between the lines:
וכאשר חטא ונטה אחרי תאוותיו הדמיונות ותענוגות חושיו הגופניים כמו שאמר כי טוב העץ למאכל וכי תאוה הוא לעיניים
The Rambam describes what the sin was - it was going after his תאוות, choosing his desires over his intellect. Thus he brings the following of the sensual draw of the tree as textual support. Adam had such a thing as desire, and his charge was to not be נוטה (to "lean") towards it. Adam was aware of the concept of sensual pleasure, and he had desires. His charge and his challenge was to ignore it, and to choose to remain "שכלי" - an intellect.