I have a proof that shows that if $5 \mid xy$ then $5 \mid x$ or $5 \mid y$.
It's pretty clear to me that I can just say that suppose $5 \mid x$, then $x=5a$, where $a$ is an integer.
then $xy = 5(ay)$, and thus $5 \mid xy$.
However, I'm having trouble understanding how this shows that $5 \mid xy$. I understand how it works for like $5 \mid x$, but am unsure how the $(ay)$ proves that $5 \mid xy$.
You appear to be mixing up things.
On the one side, you appear to want to prove that divisibility is transitive, in the particular case $5 \mid x$ and $x \mid xy$ implies $5 \mid xy$.
Now to say that $u$ divides $v$ it means there exists an integer $w$ such that $v = u w$. So when you get $xy = 5 \cdot (a y)$ you have that $u = 5$ divides $v = xy$, here $w = a y$.
On the other side, if $5$ divides $xy$, that is, there exists $z$ such that $x y = 5 z$, factor $x, y, z$ as products of primes. Since the prime $5$ appears in $5 z$, by the uniqueness of factorization it has to appear also in $x y$, that is, either as a factor of $x$, or as a factor of $y$.