HTTP status code 301 is known as permanent redirect. It means that the resource (page) is moved permanently to a new location. The client/browser should not attempt to request the original location but use the new location from now on.
HTTP status code 302 means that the resource is temporarily located somewhere else, and the client/browser should continue requesting the original url for subsequent requests.
Edit
Why do we use these codes?
Browsers(well most of them) cache 301 redirects indefinitely. So when browser makes a call to original resource second time, it always calls the redirected resource. To undo this, you need to issue a 301 direct from new resource to old resource. If you would like to control the caching duration, you can use the the HTTP response headers Cache-Control and Expires to do the same.
302 redirects are not cached by browsers. So when browser makes a call to original resource second time, it calls the original resource.