What you are referring to is the "stacks as sheaves of groupoids" point of view.
To illustrate where it comes from, imagine for example that we are talking about the moduli stack of elliptic curves (on the category of schemes). To give an elliptic curve over a scheme, it is not just enough to specify the elliptic curve over the members of the open cover; we have to explain how we glue the restrictions of the curves on the various opens on their overlaps, and this gluing has to be coherent over triple overlaps.
The reason for this is that elliptic curves can have non-trivial automorphisms, so that there is no a priori determined way to make the identifications on the overlaps (because having non-trivial automorphisms is the same as saying that when two curves are isomorphic, they can be isomorphic in more than one way), so it is your job to choose these identifications, and to make sure that you do it in a coherent way.
(Here elliptic curves can be replaced by any other moduli problem you can think of, of course.)