You don’t say what kind of space $X$ and $Y$ are subspaces of. But if they sit in an oriented manifold there’s an easy way to define an intersection product in homology. Namely if $M$ is an oriented $d$-manifold then there is a PoincarĂ© duality isomorphism

$$ H_i(M,mathbf Z) cong H^{d-i}_c(M,mathbf Z)$$

between homology and compactly supported cohomology. The cohomology with compact support is a ring (though typically a non-unital ring) for the same reason that the usual cohomology is a ring: use contravariant functoriality for the diagonal morphism. In this way we obtain an intersection product on homology.

One can also work with Borel-Moore homology which is sometimes even nicer: under PoincarĂ© duality the Borel-Moore homology corresponds to the usual cohomology, and in particular we get a unital ring, the unit being given by the fundamental class. And fundamental classes exist very generally in Borel-Moore homology, for example any irreducible algebraic variety (not necessarily smooth, not necessarily compact) has a fundamental class.

This is all easier than what Fulton does in his book. But Fulton obtains an intersection product on Chow groups, which carries more refined information.