I have a friend, who is not professionally trained in music. When she hums (with her mouth closed), she hits the right notes and everything. When she actually starts to sing, I felt her notes appear to be all over the place. I have caught her singing when she is not aware she's singing...sort of like she's singing subconsciously, and she managed to hit right notes again. What gives? Is this simply a case of lack of practice?
Short answer: The behavior you describe is pretty common, and the result of a combination of physiological and psychological differences.
Longer answer: First, humming increases the "internal resonance" your vocal chords produce. This increases your ability to hear yourself while humming, and so if you have any ability to perceive tone, you will also be better able to tune yourself while humming than while singing.
Also, because the air is leaving through your nose, a smaller opening than your mouth, you're introducing more "back pressure", which in moderation actually improves most of the positioning of the diaphragm, mouth, throat and nasal passages that are taught by vocal coaches as "good technique". The throat widens, the soft palate lifts, and the nasal passages open. In addition, because of the back pressure, your exhalation is controlled with less concentration on your part. This results in less variation in tone due to changes in positioning of these things which can push pitches around.
This phenomenon is used by many vocal coaches during warm-ups, to encourage the singers to maintain what they feel when humming as they open their mouth. By doing so, the singers naturally adopt many good habits that can be further tweaked by the coach.
There are also some psychological things at play. If you cannot hear yourself well, or don't want anyone to hear you, you will naturally sing more quietly. For an untrained singer, the two "natural" ways to do this are to drop the breath support (which drops the pitch; imagine the sound a bagpipes makes as the bladder runs out of air and the drones stop), or to close off the throat (which normally pinches notes sharp). Both are bad technique; the "right" way to sing more softly is to use the diaphragm to reduce the amount of air going through the vocal chords without completely dropping breath support. Simply being nervous, knowing that people are listening, will also make a singer trend sharp because of the natural tensing of a whole host of muscles controlling breath and voice.
Being nervous coupled with bad singing technique will cause notes to go totally wild, as the lack of breath control pushes notes flat while the nervousness trends them upward, and one or the other will "win" on each note.
Weird! It's probably to do with psychology of performance and social pressures. I base this on the presumptions that:
Since you have observed her being pitch-accurate (whether singing or humming), we can conclude that she has at least a rudimentary ear, even if it isn't well-developed through training. A rudimentary ear--able to hear a melody, internalize it at some level, and then replicate it--is all one really needs to be able to sing socially (i.e. hold a tune in a bucket, sing in key). There is virtually no difference between singing and humming (humming is simply singing on an 'm' sound).
I would guess that when her notes are all over the place, she's in a sort of "I don't sing; this is what it sounds like when I try to sing" mindset. What results from this mindset are behaviors or habits that are counterproductive to actually singing in key. Maybe she thinks she has to "oversoul" it, sing too loudly, or maybe she's just yelling because the alternative is too embarrassing. I have no idea; you'll have to figure that one out for yourself.
To resolve the issue:
For an exercise, she could try humming a simple tune on an 'mmmm' syllable, then try it on an 'nnnnn'. Then, slowly and on each note, start on 'nnnnn' before opening to 'aaaaa', and then do the same with 'mmmmmaaaaaaaa'. Last, use only the 'ah' syllable.
That's about as broken-down as I think it can get. Let me know in a comment if any of this was the least bit helpful or applicable to your situation!