Welcome to TeX.SE!
First and foremost: obviously, Zarko's remark applies: automatic resizing can easily lead to ugly and/or unreadable output. I'll answer your question on technical grounds, but you should consider whether the result is typographically acceptable.
The table environment produces a float, contrary to tabular which creates a box. Resizing a float doesn't really make sense, but resizing a box does. So, let's first change your table.tex like this:
\begin{tabular}{cc}
X & Y \\
Z & A
\end{tabular}
With this and main.tex unchanged except for the required \usepackage{graphicx}, your example works. Of course, you'll have no float anymore. You should also remove unwanted spaces from this main.tex—see below.
If you want to keep the floating behavior, and thus the table environment, put it around the \resizebox command, like this:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{table}
\resizebox{\linewidth}{!}{%
\input{table.tex}%
}% here, the percent sign could be removed (end of paragraph)
\end{table}
\end{document}
Beware of unwanted spaces: when you write
\resizebox{\linewidth}{!}{
...
there is a space at the beginning of what you resize (contributed by the end-of-line). Better use:
\resizebox{\linewidth}{!}{%
In some places, spaces are ignored (for instance, at the end of a paragraph [where TeX adds an implicit \unskip], in vertical mode or after \begin{table} or \begin{tabular}{...}), but not everywhere; in this case, you would have an unwanted space without the percent sign. You can compare this:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\noindent \resizebox{\linewidth}{!}{a}
\end{document}
with that:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\noindent \resizebox{\linewidth}{!}{
a}
\end{document}
The added space is clearly visible on the output obtained with the latter (the a is smaller and not centered anymore: there is an interword space on its left). Obviously, due to TeX rules regarding input handling, you get the same result with this:
...
\noindent \resizebox{\linewidth}{!}{ a}
...
I only used the version with a newline before the a because this is the input style used in your example (and exhibits the spacing problem).