A query is a single statement in SQL's data manipulation language: typically one of SELECT, INSERT, UPDATE or DELETE (the latter three may modify data, while SELECT only reads data).
A transaction is a group of statements which taken together, are usually defined to have "ACID" semantics (my own off the cuff definitions are below, but these are defined in any web or paper reference to relational database):
Atomicity (all statements in the transaction are executed, or none)
Consistency (the database is never viewable in an inconsistent state)
Isolation (a transaction does not affect other transactions)
List item Durable (once committed, the changes in the transaction are permanent)