I will be visiting Texas and staying at my girlfriend's home. Would I have the right to defend myself with her firearm in the case of a burglary etc, or would I be in big trouble?
This is the Texas law pertaining to self defense, which says that "a person is justified in using force against another when and to the degree the actor reasonably believes the force is immediately necessary to protect the actor against the other's use or attempted use of unlawful force". Relatively little of the law pertains to firearms, and none of it restricts the right to self-defense based on whether you are a resident, or you are using your own firearm vs. a borrowed one. The one provision, subsection (b)(5), that refers to firearms is an exception whereby force is not justified, namely
if the actor sought an explanation from or discussion with the other person concerning the actor's differences with the other person while the actor was:
(A) carrying a weapon in violation of Section 46.02; or
(B) possessing or transporting a weapon in violation of Section 46.05.
(Sect. 46.02 is about conditions unlawful carrying of weapons, which covers such things as under-age carrying of certain knives, or not having control of your weapon, or being a felon in possession, etc. 46.05 is about machine guns, explosives, zip guns etc.)
Deadly force is covered by a separate section, 9.32, adding the requirement that the actor "reasonably believe the deadly force [to be] immediately necessary".
(A) to protect the actor against the other's use or attempted use of unlawful deadly force; or
(B) to prevent the other's imminent commission of aggravated kidnapping, murder, sexual assault, aggravated sexual assault, robbery, or aggravated robbery.
Note that "deadly force" is defined as "force that is intended or known by the actor to cause, or in the manner of its use or intended use is capable of causing, death or serious bodily injury". Sec. 9.33 likewise allows deadly force to be used analogously in defense of a third person, and intreestingly, in 9.34(b), "A person is justified in using both force and deadly force against another when and to the degree he reasonably believes the force or deadly force is immediately necessary to preserve the other's life in an emergency".
In addition, deadly force can be justified in defense of property, per sec. 9.41, if you "reasonably believe the force [to be] immediately necessary to prevent or terminate the other's trespass on the land or unlawful interference with the property", and you may also use force to recover or re-enter the property (as long as the force is used "immediately or in fresh pursuit after the dispossession", and "the actor reasonably believes the other had no claim of right when he dispossessed the actor; or the other accomplished the dispossession by using force, threat, or fraud against the actor"). Sec. 9.42 then provides the possibility of justified use of deadly force in protection of property, if the force is immediately necessary
(A) to prevent the other's imminent commission of arson, burglary, robbery, aggravated robbery, theft during the nighttime, or criminal mischief during the nighttime; or
(B) to prevent the other who is fleeing immediately after committing burglary, robbery, aggravated robbery, or theft during the nighttime from escaping with the property; and
(3) he reasonably believes that:
(A) the land or property cannot be protected or recovered by any other means; or
(B) the use of force other than deadly force to protect or recover the land or property would expose the actor or another to a substantial risk of death or serious bodily injury.
The short version is, if deadly force is justified in the particular circumstances, then deadly force with a borrowed weapon is justified.
However, there are federal laws regarding non-resident aliens possessing firearms. 18 U.S.C. 922(g)(5)(B) says that
It shall be unlawful for any person...who, being an alien (A) is illegally or unlawfully in the United States; or (B) except as provided in subsection (y)(2), has been admitted to the United States under a nonimmigrant visa (as that term is defined in section 101(a)(26) of the Immigration and Nationality Act (8 U.S.C. 1101(a)(26)))...to ship or transport in interstate or foreign commerce, or possess in or affecting commerce, any firearm or ammunition; or to receive any firearm or ammunition which has been shipped or transported in interstate or foreign commerce
Under subsection (y) there are exceptions for licensed hunters, government representatives etc. You can also petition the Attorney General for an exception.
The point is that federal law would make possession of a firearm illegal for most visa types: here is the list.