Both Gerund and infinitives can be nouns, which means they can do just anything that a noun can do like as a subject or object in a sentence.
Examples for Gerund :
1. Swimming is my hobby
2. Sleeping is one of things I need
3. Jogging is his favorite exercise
4. She can’t do juggling anymore
5. Cooking is my mom hobies
Examples for Infinitive :
1. She doesn’t like to meet me
2. I decided to take a part in the competition
3. She needs to sleep well
4. He learns to swim
5. He decudes to swim