I was listening to music, and I got a sudden burst of inspiration. Normally, I'll just listen to my gut on what to start making, since if I wait too long, or think too hard, I tend to lose that feeling I have. Normally, I'd think of the notes that fit to the melody in my head, do it, and it would stick. Lately for some reason, every time I start humming or thinking of a melody, the notes that pop in my head completely contradict all logic or sound all together, even sometimes changing the key from major to minor or minor to major. Help?
“Even changing the key from major to minor”
This makes me think your theoretical knowledge is simply underdeveloped compared to your intuitive understanding of the genre you are trying to compose in, since there is nothing at all saying you cannot change from major to minor or vice versa (the term for this is a “modal change”). My guess is (but without more information, I can hardly confirm it) your theoretical knowledge is insufficient to explain your ideas stemming from your intuitive understanding and you think the fact that you cannot explain theoretically how a melody or progression works means it is somehow forbidden. This is, however, not the case at all! If it sounds the way you want it to sound, write it down. Then theorise later (if you must – this is an optional step). You may very well find (by eventually asking here for example) it is not as unusual as you think it is. However, if you do something truly “unexplainable” (very improbable) that is no problem at all: theory is descriptive, not prescriptive. This means that you can do stuff theory is not equipped to describe, since theory is only constructed after the fact to explain what previous composers did.
As a bit of background information, music history is filled with crossings of the boundaries of music theory. Some notable examples include (this is a very short list of some things I happen to be able to name off the top of my head, I do not mean to imply these are the most significant or some other kind of ranking): the abandonment of tonality (by Arnold Schönberg), extended techniques, microtonal music or electronic music. You will find that the first time these things happened (unless you count col legno as an extended technique, as Wikipedia does) there was no theory governing it at all, just people experimenting. While experimenting Schönberg developed his own theoretical framework for dealing with free atonality (never really published) and later dodecaphony (quite well-documented, although mainly by his pupils). I hope you can now see, in music practice comes before theory.
Warning: I do not mean to imply theory is not useful or that it is good to ignore it. Theory is a very useful tool but if I am right and your intuitive understanding outstrips your theoretical knowledge as completely as I think, you need to learn more theory before you can reap its benefits. However, if one’s theoretical knowledge is (more or less) on par with one’s intuitive understanding it can of course tell you what works and what doesn’t (within the theoretical framework you are using). Leaving the theoretical framework you are using is not prohibited but risks doing something weird and your audience might or might not like it. In a sense it is taking a risk. However, in your case it seems your theoretical framework is limiting your creativity so severely it doesn’t make sense to let it constrict you until you learn more theory.
Don't worry about 'contradicting logic'. That just means that your current level of 'theory' doesn't have a name for what you just wrote! Moving between major and minor is fine. If it makes you feel better I'll offer you a label to stick on it - 'Modal Interchange'. The name isn't important. It just tells us that moving between major and minor is so commonly done that it's been given a name!
Maybe you'll do something so original that no-one's given it a name yet! That's fine too.
But one word of advice. If you're going beyond the bounds of your theoretical knowledge, LISTEN especially carefully. And think about being consistent. One 'outside' note or chord in a piece might be magical, it might stick out like a sore thumb. Your call!