My friend told me the American accent is actually how English people spoke during the period of colonization. Is this true? Also did people speak differently in history and how can we know this?
This is one of the times that the lack of uniform education really comes in handy. While many of the educated elite spelled words in a more-or-less conventional fashion, the less-educated and barely literate tended to spell words phonetically. This gives us an excellent sense of what individuals sounded like, and sources can be compared to help determine an accent.
Songs and poetry are also useful for this. The way that things rhymed or flowed helps indicate how words were pronounced and emphasized.
Finally, and perhaps most vividly, there are some places where people and accents remained isolated, and thus relatively unchanged. This is why your friend could claim that the modern American accent might be closer to 18th century English accent. For an example of this "living fossil" accents, compare the accent from Virginia's Tangier Island to British attempts to reconstruct the accent used in Shakespeare's late 15th/early 17th century accent.
Also, remember that, then as now, there was no singular American accent, just as there is not a single British accent. With so many immigrants coming from so many different parts of Europe (and the world!), accents would have varied by region, age, and how many generations a person had been in America.
hi! if you're interested in more, you may get something out of these sections of the FAQ
How far back could I go and still communicate? - some examples of how English was spoken differently in the past
and this post has a pile of links that could shed more light on the question of "how do we know?"
You've already gotten some good answers, and the threads suggested by /u/searocksandtrees provides some good discussion on the topic. The short of it is that your friend is wrong. Both the American and British accents have changed substantially.
Two other threads that you might be interested in that were posted in /r/linguistics are below: