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...