This is an episode about the Milgram Experiment, a psychological experiment carried out in 1961 and designed to determine what people would do if they were told by an authority figure to do something that would violate their own conscience. In the experiment, the test conductor (who was actually the test subject) was required to administer shocks of progressively higher voltage to a student in another room who he could not see when the he got a question wrong. The student was an actor who gave increasingly loud screams as the shock level was incremented and complained that he had a heart condition and this was getting dangerous as well as painful. The tests were conducted in several ways, some with the authority figure in the room and some without his presence.
The purpose of the experiment was to see whether people would do things that went against their conscience, in large part to determine why seemingly normal people could operate Nazi death camps and whether this was an exclusively German anomaly or whether it could happen anywhere. Most subjects would do what they were told regardless of any sense of morality and people who were teachers usually scored the worst.
In this case, Giles was the test conductor and he failed miserably. Buffy should have written him and the Watchers' Council off permanently at this point. The experiment was dangerous and threatened Joyce as well due to bad planning on the part of the Council. In the real world, Giles would be convicted of administering a toxic substance, reckless endangerment and conspiracy. But the story required Giles to stay in the picture and therefore required Buffy to forgive him. The one character development that happens after this episode is that Buffy never wants to go back to being an ordinary girl again.