Here’s how(PDF) it works in the US.
Basically, banks are in a business of borrowing money at a lower interest rate and lending it at a higher interest rate. If the bank borrows primarily in the short term (as they do), then they cannot lend at primarily a long term, at least not at a much higher interest rate, as it would result in a duration mismatch on the balance sheets. Thus in most countries, e.g. Canada, an otherwise identical market, the maximum period that one can “fix” a mortgage rate is ~5 years, at a rate that will be higher than the current floating rate, and in American parlance the “ARM” is the only type of mortgage available.
Banks in America can offer “fixed rate” mortgages because they have access to a secondary market in mortgage backed securities, created by Fannie Mae and the federal government, and thus are shielded from the interest rate risk.
It’s sort of a bit more complicated than that in reality but that’s the gist of it.