The U.S. drone that entered Iranian airspace recently was likely spying on Iran. The U.S. is still at odds with the Iranian government on many issues; including their nuclear program. It is likely that the U.S military and/or CIA were wanting to conduct reconesense on the country to see what their military was up to.
The United States simply can't help itself these days. All these cool toys and so many "bad" countries that we have to police from across the globe. I'm sure that this is one of many programs being utilized to spy on Iran. We know that if the government has the toys, they are going to use the toys. Especially when they yield hard-to-obtain information.
Because the US and other countries are authorized to conduct military survelliance using satellites orbiting the Earth in outer space that have cameras and lenses powerful to photograph license plates on cars, there's no need for the US to spy on Iran using a farming or other drone. It's a waste of money and time unless there's another purpose, such as rendering humanitarian aid or helping local authorities with special projects.
An isolated drone was probably a mistake, since it came from Afghanistan -- or a test to see if the drone was detectable by Iran. One drone by itself is not an invasion and was probably not an attempt to spy on Iran, but simply a drone that went astray.