Each organization and author has a different definition for these terms.
In this article, Mike Cohn provides his definition of User Stories, Epics and Themes:
A user story is simply something a user wants. User stories are more
than just text written on an index card but for our purposes here,
just think of user story as a bit of text saying something like,
"Paginate the monthly sales report" or, "Change tax calculations on
invoices." Many teams have learned the benefits of writing user
stories in the form of: "As a <type of user> I <want/can/am able
to/need to/etc.> so that <some reason>." But it is not necessary that
a user story be written that way. Check out the advantages of that
user story format.
A Scrum epic is a large user story. There's no magic threshold at
which we call a particular story an epic. It just means "big user
story." I like to think of this in relation to movies. If I tell you a
particular movie was an "action-adventure movie" that tells you
something about the movie. There's probably some car chases, probably
some shooting, and so on. It tells you this even though there is no
universal definition that we've agreed to follow, and that an
action-adventure movie must contain at least three car chases, at
least 45 bullets must be shot, and ….
So, "epic" is just a label we apply to a large story. Calling a story
an epic can sometimes convey additional meaning. Suppose you ask me if
I had time yesterday to write the user stories about the monthly
reporting part of the system. "Yes," I reply, "but they are mostly
epics." That tells you that while I did write them, I didn't get the
chance to break most of them down into stories that are probably small
enough to implement directly.
Finally, "theme" is a collection of user stories. We could put a
rubber band around that group of stories I wrote about monthly
reporting and we'd call that a "theme." Sometimes it's helpful to
think about a group of stories so we have a term for that. Sticking
with the movie analogy above, in my DVD rack I have filed the James
Bond movies together. They are a theme or grouping.
During the sprint, tasks are defined for each user story, so that the development team can have a clear sense of how it will accomplish its work. Tasks are simply more granular versions of the work entailed to complete a user story. A task is a technical piece of work necessary to get a story done. Developers split a story in technical tasks to get a realistic estimate of the time it will take to complete a story. It is important to note that user stories are usually estimated using story points, whereas tasks are estimated with hours.
A feature is a distinct element of functionality which can provide capabilities to the business. It generally takes many iterations to deliver a feature. A user story is a part of the feature. By splitting a feature in smaller stories, the user can give early feedback to the developers to issues quickly.
The relationship between epics and features is the most controversial in the agile community. In my opinion, an epic is a broader concept and an epic can be broken down into different features.