Short Answer
Bob is a non-US citizen and is visiting the USA on a tourist visa. . . .
Can Bob invoke the 5th amendment to avoid self-incrimination?
Yes.
The 5th Amendment is a right applicable to all criminal defendants or potential criminal defendants, not only to U.S. citizens. In Sanchez-Llamas, the U.S. Supreme Court confirmed U.S. Supreme Court precedents in place since 1896 holding (among other things) that:
A foreign national detained on suspicion of crime, like anyone else in
our country, enjoys under our system the protections of the Due
Process Clause. Among other things, he is entitled to an attorney, and
is protected against compelled self-incrimination. See Wong Wing v.
United States, 163 U. S. 228, 238 (1896) ("[A]ll persons within the
territory of the United States are entitled to the protection
guaranteed by" the Fifth and Sixth Amendments).
Sanchez-Llamas v. Oregon, 548 U.S. 331, 350 (2006).
Some Narrow Exceptions To The General Rule
Diplomats Immune From Criminal Prosecution
This said, the 5th Amendment right not to be forced to incriminate oneself logically might not apply to certain foreign diplomats who are immune to criminal prosecutions in the U.S., since they cannot "self-incriminate" in the sense of making themselves subject to a U.S. criminal prosecution based upon the information that they disclose. But, I'm not aware of any case law addressing that point, only case law addressing other cases where the 5th Amendment right not to self-incriminate did not apply when the person seeking to invoked it was immune from prosecution for the crimes that the defendant might incriminate himself or herself of, for other reasons.
Foreign Corporations
Also, while the 5th Amendment states that it applies to "all persons", this is not a part of the constitution in which the definition of a "person" have been extended to apply to corporations and other entities. Compare Citizens United v. FEC, 558 U.S. 310 (2010) (holding that the free speech clause of the First Amendment prohibits the government from restricting independent expenditures for political campaigns by corporations, including nonprofit corporations, labor unions, and other associations).
Neither domestic corporations nor foreign corporations have a right to not to self-incriminate under the 5th Amendment to the U.S. Constitution.
A corporation is not protected by the constitutional privilege against self-incrimination.
Curcio v. United States, 354 U.S. 118, 122 (1957).
Why Is This Right Extended To Non-Citizens?
The reasoning behind why the 5th Amendment protects foreigners as well as U.S. citizens is different in the case of federal officials and court cases than it is in state and local matters.
Why Does This Apply To Non-Citizens In Federal Courts?
This is directly true in federal criminal cases as a result of the 5th Amendment to the U.S. Constitution (and originally this applied only to federal court cases), which by its terms applies to all "persons".
The 5th Amendment to the U.S. Constitution states (with the pertinent language in bold):
No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a grand jury,
except in cases arising in the land or naval forces, or in the
militia, when in actual service in time of war or public danger; nor
shall any person be subject for the same offense to be twice put in
jeopardy of life or limb; nor shall be compelled in any criminal
case to be a witness against himself, nor be deprived of life,
liberty, or property, without due process of law; nor shall private
property be taken for public use, without just compensation.
Why Does This Apply To Non-Citizens In State And Local Courts?
In state and local courts in the U.s., this is true as a result of the 5th Amendment to the Bill of Rights being "incorporated" to apply to state and local governments via the 14th Amendment due process clause of Section 1 of the 14th Amendment which applies to "any person", rather than the original U.S. Constitution's or the 14th Amendment's privileges and immunities clause which apply only to U.S. citizens.
Section 1 of the 14th Amendment to the U.S. Constitution states (with the pertinent language in bold and in bold and italics, and the 14th Amendment privileges and immunities clause in italics only):
All persons born or naturalized in the United States, and subject to
the jurisdiction thereof, are citizens of the United States and of the
State wherein they reside. No State shall make or enforce any law
which shall abridge the privileges or immunities of citizens of the
United States; nor shall any State deprive any person of life,
liberty, or property, without due process of law; nor deny to any
person within its jurisdiction the equal protection of the laws.
Article IV, Section 2 of the U.S. Constitution states (with the privileges and immunities clause in italics and the repealed third clause of Article Iv, Section 2, related to returning fugitive slaves, omitted):
The Citizens of each State shall be entitled to all Privileges and Immunities of Citizens in the several States.
A Person charged in any State with Treason, Felony, or other Crime,
who shall flee from Justice, and be found in another State, shall on
Demand of the executive Authority of the State from which he fled, be
delivered up, to be removed to the State having Jurisdiction of the
Crime.
The decision to use the 14th Amendment due process clause rather than the 14th Amendment privileges and immunities clause, was made, in part, because the Slaughter House cases, decided by the U.S. Supreme Court in 1874 before the incorporation doctrine had been developed, narrowly interpreted the privileges and immunities clause as something that applied to only a handful of "rights of federal citizenship.'
Could The U.S. Supreme Court Change This Rule?
The current Justices on the U.S. Supreme Court can change the interpretation of the U.S. Constitution prospectively, as they did recently and famously, for example, by overruling Roe v. Wade, 410 U.S. 113 (1973), in its decision in Dobbs v. Jackson Women's Health Organization (June 24, 2022) decision.
So, it is also worth noting that U.S. Supreme Court Justice Clarence Thomas, in a dissent in the case Saenz v. Roe (1999), has argued that the U.S. Supreme Court made a mistake to incorporate the Bill of Rights to the states via the due process clause of the 14th Amendment, rather than the 14th Amendment privileges and immunities clause, as a result of the much maligned Slaughter House cases.
The Slaughter House cases were decided in a manner that minimized the effect of the privileges and immunities clause of the 14th Amendment in a manner that reflected their conservative resistance to the post-Civil War reforms of the Reconstruction era and the Civil War Amendments to the U.S. Constitution (i.e. the 13th to the 15th Amendments).
But the Slaughter House cases nonetheless are still good law. This is because this precedent was too settled to be easily undone, and because other means had been developed to serve the purposes it was intended to serve when adopted, by the time that sentiment on the U.S. Supreme Court had changed to accept the demise of slavery, when the U.S. Supreme Court ended the "separate but equal" doctrine of Plessy v. Ferguson, 163 U.S. 537 (1896), in Brown v. Board of Education, 347 U.S. 483 (1954).
Justice Thomas argued in his dissent in Saenz v. Roe that the Bill of Rights should instead have been incorporated via the privileges and immunities clause of the 14th Amendment, and that the Slaughter House cases and the various cases establishing the incorporation doctrine as arising under the due process clause of the 14th Amendment should be overruled.
If this had been done, it would have denied non-U.S. citizens in the United States the protections of the U.S. Bill of Rights in state and local courts, since the privileges and immunities clause of the 14th Amendment applies only to U.S. citizens.
However, despite the minority views of Justice Thomas, this is unlikely to happen, because not enough other U.S. Supreme Court justices have shown any inclination to take this step, even now that Justice Thomas is part of a 6-3 very conservative majority on the U.S. Supreme Court that has been inclined to reverse other longstanding U.S. Supreme Court precedents.
Other Rights Of Non-Citizens Interrogated For Crimes
Foreigners also have a right under U.S. treaties to consular assistance, under Section 36 of the Vienna Convention.
But, unlike the 5th Amendment right, this right arising under U.S. treaties has only rarely been afforded an exclusionary rule type protection to foreign criminal defendants if it is denied, in the way that 5th and 6th Amendment violations of the rights are foreign criminal defendants are protected.
In denying defendants exclusionary rule protections for violations of Section 36 of the Vienna Convention, the U.S. Supreme Court concluded in Sanchez-Llamas v. Oregon, 548 U.S. 331 (2006), which addressed all of these issues, that since most Vienna Convention members to not provide an exclusionary rule remedy (something unique to U.S. law) to violations of this treaty right, that U.S. states were also not compelled to do so.