Answer:
The correct answer is D. to swim.
Explanation:
An infinitive is a combination of the word to and a verb, in this case, swim.
A is incorrect because the word "the beach" is not a verb, but rather a noun, so that cannot be an infinitive. B and C are also incorrect as they don't even have the word to (B is a noun, and C is a verb in past tense, so it cannot be an infinitive since infinitives have no tenses - they are just the basic form of the verb).