Most of the wildfowl species are pretty closely related and will interbreed and produce fertile young.
But they are flocking species and tend to mate for life. So a greylag will flock with other greylag gooses and mate with a graylag and produce graylag offspring. And this helps to keep the species breeding true.
However the do get lost, especially given that they migrate over long distances. Here on the east coast of Scotland there was a snow goose that was part of a flock of pink footed gooses. They are all pretty much the same size and shape. Snow geese breed in Western Greenland, Pinks also breed in Greenland, so can imagine that the Snow goose got blown off course and found new friends and chances are in bred.
As for Canada’s and Greylags, Greys have become very much more a resident, so rather than flying up to the Arctic to breed, many now breed here in the UK.
UK has a large population of resident Canada geese (although there is now a population that migrates up and down east coast of Scotland). Easy enough for a canada and a greylag to overlap, and looking for a mate and as they say the rest is history.