How did Macbeth turn from a loyal and heroic warrior to a blood thirsty madman?
In Macbeth, the protagonist's (Macbeth's) character changes during the action of the play. Unfortunately, I must say that I disagree with the label that you assigned to him--"bloodthirsty madman."
Now, that being said, to begin, yes--Macbeth begins the play as a loyal and heroic warrior. Evidence of this is seen in the conversation between Duncan and Macbeth:
Only I have left to say,
More is due than more all can pay. ( I, iv, 23-24)
Here readers can see that Duncan sees Macbeth as a loyal and worthy warrior. If he did not, he would not offer up the praise and note of inability to "pay" Macbeth for all he has done.
After the prophecy is given to Macbeth, he does begin to change. Given that the witches have told him that he is to be king, Macbeth loses his loyalty and, rather, becomes concerned with gaining the crown.
So, the question lies in the following: Is Macbeth a bloodthirsty madman? Is Macbeth both bloodthirsty and a madman. I tend to fall on the side of the later.
Macbeth is bloodthirsty. The only way for him to gain the crown is through murder. This murderous rampage is fueled by his wife. She does not wish to allow the crown to come to Macbeth naturally. Instead, she believes that he must take it. Macbeth can only do this through murder. Lady Macbeth states her opinion, regarding Macbeth's ability to gain the crown proactively, in her soliquoy in the beginning of Act I, Scene V:
Glamis thou art, and Cawdor, and shalt be
What thou art promised: yet do I fear thy nature;
It is too full o'the milk of human kindness
To catch the nearest way.
Here, readers can see that Lady Macbeth does not believe that Macbeth is "man enough" to gain the crown by any means necessary. Instead, she knows that she must put the pressure on him to do what must be done: the taking of the crown. Therefore, Macbeth does murder, but the blood thirst belongs to Lady Macbeth.
While Macbeth does become mad during the action of the play, he does recognize the fact that the blood on his hands is there to stay; it cannot be washed by even "Neptune's Ocean." Here is another example of why Macbeth could not be considered bloodthirsty:
I'll go no more:
I am afraid to think what I have done;
Look on 't again I dare not. (II, ii, 51-53).
In Act I, Scene I, Macbeth begins his downward mental spiral. He sees the image of a dagger before him. At the opening of Scene II, Macbeth recounts his murder of Duncan's chamberlains. Here is where Macbeth realizes that the murders will affect him. Macbeth tells Lady Macbeth that he cannot say the word "Amen" and that he knows he will no longer be able to sleep. With the murder of the chamberlains, Macbeth "murdered" his own ability to sleep.
Another place where readers can see that Macbeth has lost his mind is the appearance of Banquo's ghost in Act III, Scene IV. This apparition is a reminder of Macbeth's guilt--something that will cause many to go mad. It is true that as the play progresses and more are murdered, his madness does seem to make hi bloodthirsty.