There are numerous examples of dialects which result from language contact. A typical case would be Indian English (the dialect of English that has become native to India), which arose from contact between British English and various indigenous languages of India. Similarly, the Highland (northern) Ecuadorian dialect of Spanish differs from other nearby dialects of Spanish in ways that reflect properties of the local indigenous language, Quechua. There are some instances where we can be fairly certain that a dialect difference is not due to this kind of language contact, such as some NE/SW Icelandic dialect differences pertaining to aspiration -- where there is no substratum or differential external influences that could explain the differences. But it's far from a foregone conclusion that the difference between English in NW England versus London are strictly due to random divergences starting from a homogenous older version of English. In most cases, we simply do not have enough historical evidence regarding the development of dialects to be able to confidently say that a given difference can be due to some kind of "external" influence.
Linguists don't put much stock in a strict dichotomy between language and dialect, because there's no objective standard for classifying systems as being dialects vs. languages. The best we hope for is a metric of mutual intelligibility. Swedish and Norwegian are classed as distinct languages, but they are close enough that a speaker of one can understand and be understood by a speaker of the other (there are outlier exceptions). There are numerous problems with the concept of mutual intelligibility, for example asymmetries in intelligibility, where spoken Danish is apparently harder for Norwegians to understand that Norwegian is for Danes; and there are "logical inclusion" problems where all speakers of X also speak Y but the opposite is not true (e.g. all Kerewe speakers speak Jita but the reverse is not true). Once a speech form becomes so different that speakers cannot understand each other, then linguists embrace the notion that they are different languages. However, speakers themselves may have a different attitude. Kurmanji, Sorani and Gorani ~ Hawrami are sufficiently divergent language forms that I think they would have to be termed separate languages, but they are often simply called "Kurdish" and referred to as dialects (emphasizing political and cultural unity).
As for "accent", we put zero stock in that term, which is a term that we abjure, at least when speaking professionally. A "Chicago accent" is the dialect spoken in Chicago (with other social modifiers necessary to pick out the right dialect).
You might want to take a look at William Labov's books Principles of Linguistic Change, in 3 volumes.