The untutored thug mathematician in the movie Good Will Hunting was supposedly based on the Indian mathematician Srinivasa Ramanujan, who did his first work as a self-taught unknown in faraway Tamil Nadu, but for the thug part Évariste Galois would have been a far better choice:
On the following Bastille Day, Galois was at the head of a protest, wearing the uniform of the disbanded artillery, and came heavily armed with several pistols, a rifle, and a dagger. For this, he was again arrested, this time sentenced to six months in prison for illegally wearing a uniform. He was released on April 29, 1832. During his imprisonment, he continued developing his mathematical ideas.