This was an example of classical conditioning. Classical conditioning is when two stimuli are linked together to produce a new learned response in a person or an animal.
An experiment done by Pavlov demonstrated classical conditioning in dogs. Such that; there was a neutral stimulus (the bell), which by itself will not produce a response, like salivation and also there was a non-neutral or unconditioned stimulus (the food), which will produce an unconditioned response.