The French midfielder appeared to be on his way out of the club over the summer after Wenger had previously admitted he would not stop the player leaving.
"It is true I was close to leaving because I did not play enough, so I spoke to the coach and we had a good discussion," said Flamini.
"Now I am here and am very happy to be here.
"The manager told me he had confidence in me and I said, 'All right I am going to stay and I will prove that I can play'."
Flamini's versatility has already seen him deployed in a variety of positions by Wenger, although he concedes he prefers to operate in midfield.
He added: "Arsenal is a big club with high ambitions, so the competition is here - but it will make you better.
"Sometimes I have to move, like last time when I play right-back. I like to play midfield because it is my natural position. One game by one game and I will see."