I have a question on a proof in Algebraic Geometry by Robin Hartshorne. Here is the proof:

Theorem. Let be an affine variety with affine coordinate ring . Then .

Proof. We define a map . Every polynomial defines a regular function on and hence on . Thus we have a homomorphism . Its kernel is , so we have an injective homomorphism .

Now note that , where all our rings are regarded as subrings of . Now by Theorem 3.2 in Hartshorne parts (b) and (c) we have , where runs over all maximal ideals of . Equality now follows from the algebraic fact that if is an integral domain, then is equal to the intersection (inside its quotient field) of its localizations at all maximal ideals.

I don't understand this part:

Its kernel is , so we have an injective homomorphism .

Why is the kernel ? Also, why is this an injective homomorphism? Thanks in advance.