Well, for a start, he provided an interesting historical anchor for the story. But even more than that, the real Nikola Tesla was quite an enigmatic and visionary researcher with many ambitious ideas that not all found the appreciation that they might have deserved or that Tesla might have envisioned. This has led to him getting quite a bit of cult status in popular culture, especially in speculative fiction. So his appearance in the movie (or rather the novel, which he's also part of) is another of those fictionalized idolizations and can be seen as an homage to the real Nikola Tesla, when the book/movie lets him accomplish true scientific magic. This is to some degree reinforced by screenwriter Johnathan Nolan himself in an interview:
Did you ever think about not having the Tesla machine work and that there was another way that he....a real way? Cause I was thinking he would use a double and drown him...
Jonathan Nolan: ...The more research I did into Tesla the more impressed I was with Christopher Priest's choices in the book for a promethean figure you get no finer than Nicolas Tesla I mean the man is absolutely fascinating. Based on the research I did, I'm quite convinced that the experiments we were doing in Colorado Springs were...the thing, the guide that we do in the film with the light bulbs in this sort of remote transmission of electricity through the ground and depending on who's accounts you read....he really did that. And really was....and I'm not a conspiracy theorist but he really was opening up Pandora's box that they sort of made him close.
I think it's interesting when your do encounter a character like that because he is one of those in that age of invention, he's one of those characters who has gotten shunned to the side, I mean electrical engineers know his name. But, but...
Jonathan Nolan: But a few other people and hopefully it would be fantastic if this movie were able to help bring a little more luster back to that guy. I did a lot of research on him, I went out to Colorado Springs fittingly all of his equipment that had been there in the museum had been stolen and is probably now in the hands of private collectors. He's a real cult figure, and I wound up pretty fascinated with him. They've been trying to make a Tesla film in this town for years. The problem is there is a tragic quality to his character where they really um...society doesn't know what to do with people like that, and hopefully we sort of got to the essence of that in the film.
Add to this, that the fact that Tesla made so many, sometimes obscure, inventions, many of which never even surfaced to the public, also allowed a certain creative freedom in attributing some new invention to him. And while a teleportation/cloning device might have been a little too much even for him, we'll never know what kinds of things he all ever envisioned. This is reinforced by novel author Christopher Priest in a making-off about the movie:
What I really liked about Tesla is that during his lifetime he built and patented many inventions, which he then buried in secrecy and they would never emerge. And so it seemed to me quite fair game for a novelist that Tesla would be able to come up with something the like of which has never been seen before...
But this goes even further. When we see his professional rivalry with Thomas Edison as depicted in the movie, we see a clear analogy to the rivalry between the two protagonists. And while none of the two magicians really kept their vest entirely clean during the course of the movie, Borden seems to be the moral winner of the story, whose ultimate goal always lay first and foremost in his art as a magician and who sacrificed his entire non-stage life in devotion to this art. If we set this in relation to Tesla, who was first and foremost always a researcher and Edison, who history knows did not always play nice to get his economical success, then we can see the parallels between the better magician Borden and the better showman Angier. Wikipedia supports this notion to some degree, too:
Nor is this cutthroat competition limited to prestidigitation: engineering "wizards" Nikola Tesla and Thomas Edison engaged in a rivalry over electric current, which appears in the film in parallel to Borden and Angier's competition for magical supremacy. In the book, Tesla and Edison serve as foils for Borden and Angier, respectively.
as well as does Jonah Nolan:
I'm guessing society also doesn't want to see a scientific hero being torn apart for having thugs go out and....
Jonathan Nolan: Ya Edison is a real....a...the more research you do on Tesla, the less you like Edison. You really do, you realize that there's a lot of....again this is what I was most impressed with, the more research I did the more I realized how carefully Christopher Priest had chosen the characters who appear in his novel. That the Tesla/Edison rivalry has a lot of similarities with the rivalry between the magicians and the piece Edison used all manner of PR tricks including...you can find footage online of a this PR heck that a Edison hired to go to State fairs to electrocute elephants with alternating current generators just to prove how dangerous AC was, I mean these guys did some wild, wild things...and of course Edison lost, ultimately DC was, his system was you know, use it in your car but not to many other places. AC is the thing that electrified the world, Tesla's system was correct, but Tesla lost the PR battle and you suddenly realize how important that is.
or this Arkansas Times article:
While dealing with the rivalry of two would-be magicians looking for a break in 1890s London, it manages to contrast their battle to that of Thomas Edison and Nikola Tesla over electric current, a major ingredient in the film’s defining trick.
So Tesla and his rivalry with Edison further support the primary rivalry of the story with a fitting additional historical analogy.