Someone, somewhere, seems to be giving many, many players an idea that every tune must only contain diatonic notes. It's just not true!
A lot of tunes only contain diatonic notes, but, there are probably more out there which will have notes that do not belong to a particular key.
To an extent they're the ones that find their way into melodies and harmonies, that make songs more interesting. It's often the unexpected that does it.
Nothing has to be borrowed from anywhere else, although often these occurrences can be explained away with some theory.
As Dekkadeci states, it's the dominant chord of the relative minor chord of the key. Known as V7/vi. Now, with a little theory, one thinks 'ah, but the relative natural minor of F is Dm. Dm only has Bb as an 'altered' note.'
But, there are other changed notes in other minors, and looking at both the melodic and harmonic minor scales, it's apparent that C# lives in them. So, theory says it's o.k. to use C# whilst in key F. And the reason is that C# is the leading note of Dm, making the C#>D change much more convincing than C>D.
In fact, theory says any of the 12 notes can be used in any of the 12 keys. What it does not say is that pieces should be restricted to only diatonic notes. There are many questions very similar to this, and really, there's no need for them!