Great question, Tammy. In general, we use the gerund as the subject of the verb “to be” and we use the infinitive as the predicate nominative of the verb “to be”. For example, we could use the gerund as the subject and say, “Having my own office has always been my dream”. Another example:
Studying is fun. / It’s fun to study.
This is not a strict rule of grammar, so in many cases it would be fine either way, but in the example in the OP, it sounds really weird to use the gerund in the predicate. For now, my advice would be for you to stick to the rule, but be aware that there is usually some flexibility when native English speakers are talking, and also, there are some fixed expressions and famous quotations that break the rule (or “guideline”, if you prefer).