Well, your teachers might get upset if I tell you this but: it's a lie, you will be understood haha.
I guess they say it to encourage you to correct your mistakes. You should correct them anyways. I trust you will try to speak correctly anyways, so I'm telling you te truth. I don't want you to be so worried and stressed to avoid mistakes. Just try to fix them.
Now I'll answer your next questions:
How does a native Spanish speaker feel if I someone mistakes genders?
A Native Speaker would immediately detect that you are not a Spaniard, altough the accent is the first indicator haha.
Is it offensive?
No, it is not. If it is not your native language, it's normal to commit mistakes. Nobody should get upset for that. If someone does, he's a madman.
Is it considered a mistake?
Yes, it is.
We still understand, but that doesn't mean it's not a mistake. It's like saying
"I are happy" instead of "I am happy". Everybody understands, but it is wrong. In fact, it's kind of "basic" that everything must agree, so it is immediately detected. However, some nouns are difficult, like "agua" or "mano". It's more normal that people get confused there.
or will it totally lose meaning?
Most words are equally well understood if you choose the wrong gender. For example, if you say "la agua", people would perfectly understand.
Some others can be less clear. For example, if you said "el mano", it could be confused with "hermano", so be careful.
And it's worse when similar words change meaning. For example: la puerta (the door) vs. el puerto (the port). If you mix them, like "la puerto", you wouldn't be able to tell what one you meant, unless the context is clear.
So, this is all. My point is that you should not be "scared" about commiting mistakes. Everybody does. However, it is important that you correct them.