You want to login to Website A, but Website A doesn't want to have their own credential DB, or they just want to let you use a nice github/gitlab/microsoft/facebook button.
You press the "Website B" (e.g. Microsoft) button, bringing you to Website B with an attached message "Website A wants authentication".
Website B has a credential DB and you can login to it. Website B may ask you "is it ok that we identify you to Website A when they ask?", which is e.g. github asking you to authorize access of a third party app.