Hey guys, here is a theme I recently analyzed on guitar and the key is in D major. But I noticed at the beginning, it plays a B first, and also a C which isn't in the scale. Even though the theme doesn't sound sad, could this very well be in B minor as the theme starts on B? And what rule does it allow a C to be used within the scale?

Bm is relative minor key to D... as in it has the same notes. With the C, well chromatic notes are allowed to be used... OR it could be a mode for that part of the song. There's more information on modes about this site if you're interested.
the note that it resolves to is often more important for deterimining the key than the starting note.C is just a passing tone that doesnt have to be part of the key

Tell me what nation on this earth, was not born of tragedy-Primordial