One of the answers I've read to this on previous posts is that American spelling changed the pronunciation, but if that's the case wouldn't Canada still use British pronunciation?
The spelling and accents had very little to do with each other, and there was no single British English that then got ‘changed’ to one American English. The spellings certainly didn’t create the accents.
Rather, the English of the 17th century - which had several dialects across Britain already - was very different from any modern British, American or Canadian English varieties. It was carried across from different areas of Britain to different areas of the American colonies, and changed and diverged there into several new varieties, which sometimes preserved specific phonetic features, and sometimes spread new sound changes between them. Similar developments continued in Britain, though the major dialect boundaries were older.
The modern ‘posh’ British accent developed from Home Counties accents around (but not so much in) London and became standard in British public (ie, posh) schools in the early to mid 19th century. General American developed from a few Inland Northern varieties, and certain features even spread between the U.K. and US in the late 19th century: the ‘Trans-
Some sound changes were developed in the U.K. (in Southern England, the TRAP-BATH split, where words like bath are pronounced with a long ‘ahhh’ sound, the loss of ‘rhoticism’ or the pronunciation of r at the end of syllables, etc.) and some in the US (the LADDER-LATTER merger, where a ‘t’ or ‘d’ between vowels becomes a tap, or the dropping of the ‘y’ sound in words like ‘tune’) . Others are much more complex in their variation on both sides (eg pronunciation of certain short and long ‘o’ vowels - where America has diverged more - and many others).
Canadian English too had had its own changes, most famously the ‘Canadian rising’, but is otherwise descended largely from American English varieties, the first major English speaking population in continental Canada being from American loyalists. Newfoundland is a very different story, however, and is closer to West Country (English) English and Irish English, depending where on the island.
Late in the 19th century, when southern English varieties lost their rhoticism, the ‘Trans-Atlantic accent’ was concocted to mimic this as a fashion in the educated American north-east, and Boston and other coastal American varieties adopted this. The South was otherwise influenced back and forth by the north, and the American West developed with influences from both a but chiefly the north. A NE American English had also developed, and a ‘general American’ was formed from Midwestern through to NE varieties.
All this is separate from spelling! Most languages have evolved without taking their cues from the written word, rather the other way around. And in fact many ‘British’ or ‘American’ features of spelling were not nailed down as such until the 19th century, until which spelling was largely seen as relatively free, but schools eventually made certain choices in different accidental ways when education reached the population as a whole - in the US, Webster was. a major influence here, though it’s a myth that he ‘invented American spelling’. You will see old American spellings of colour, honour and arbour and old British spellings of color, honor and arbor. Again, some ‘British’ changes were later (in this example, -our came under 18th c. French influence while the -or spelling reflected the original Latin and even Old French). Some examples are even quite silly: ‘aluminium’ was discovered and named ‘aluminum’ by Sir Humphrey Davy, but he was convinced by a colleague for classical reasons that ‘-ium’ was a ‘better’ ending. For a while the ‘aluminum’ name was more common in the U.K. and ‘-ium’ in the US. This switched around 1900 or so due to particular companies that became prominent in selling it - though this is a bit of a simplification too.
Canada was of course under British rule for longer, and British cultural influence at an official level for longer than that. People don’t so easily switch their whole spoken language and accent wholesale, but in their formal education, and in government and legal documents in the context of the British Empire, British spelling was generally (not entirely) followed, and so we see that reflected in Canadian spelling today.
So the question seems to be based on a major assumption that is incorrect in a few ways.