Every tone means something unique to every tone. The Major Scale pattern creates the numbering system for all tones from the given root.
When we are using this system to create tone group [keys], this is called derivative. Derivative means that we are deriving the tone group from the Major scale pattern [221-2221]. This process 'creates' [221-2221 is a learning tool & has no inherent meaning in itself] what tones are in the diatonic family of the given root. Diatonic means "across the tones of a key". Diatonic tones are the tones that are in the Major key; the tones that are selected by this process.
The Major scale pattern gives specific tones, specific numbers (1-7 in traditional music theory naming). Again, in itself, the Major Scale Pattern [221-2221] doesn't really mean anything. It is just a learning tool. The five tones that were eliminated by the 2's are not derivative tones, but parallel. These tones are called non-diatonic; they are tones not in the diatonic family.
Parallel tones are tones which names are created by comparing to the derived tones (1-7). We typically [most commonly] parallel to the Major. We can also parallel to minor.

Every 2 in the Major scale Pattern creates a 'gap', since tones were 'skipped' or 'eliminated' at those points.
Again, the Major Scale Pattern [221-2221] creates a numbering for the tones from the given Root [R]. Yet, there are 5 tones to the root that are still unaccounted for [named]. So, we can compare those tones to the derivative tones. This is called paralleling. Parallel = Compare.
Since D is C's 2 [only C's 2], the tone that sits in the first gap is called D-flat. [flats lower tones one half-step]. We've compared a non-diatonic tone to a diatonic tone. In a key, the 2, 4, & 6 tones are the same tones as the 9, 11, & 13 respectively. The 2 = 9, & therefore, the flat 2 is also the flat 9. The sharp 2 = sharp 9, etc.
To clarify let's use an example. In C, D is the 2 [1-2]. If we keep going, beyond the octave [the 8th tone of the scale - the C], we find D again, yet this time in position 9 [1-2-3-4-5-6-7-8-9 = C-D-E-F-G-A-B-C-D]. Same thing applies to the 11 & 13…
2 = 9: 1-2-3-4-5-6-7-8-9 = C-D-E-F-G-A-B-C-D
4 = 11: 1-2-3-4-5-6-7-8-9-10-11 = C-D-E-F-G-A-B-C-D-E-F
6 = 13: 1-2-3-4-5-6-7-8-9-10-11-12-13 = C-D-E-F-G-A-B-C-D-E-F-G-A

The top row of numbers are the half steps [numerical chromatics].
The second row are the derivative and parallel names in the traditional music theory system.
C Major is the simplest inventory. Since all the derivative tones are naturals, the sharp and flat non-diatonic tones are the sharp and flat versions of the scale members. The flat names are shown above.
The D-flat could also be called C# [#1 - this is not common]; the E-flat could also be called D# [#2 or #9], the G-flat could also be named F# [#4], the A-flat could also be called G# [#5], and the B-flat could be also called A# [#6 - this is also not common].
The non-diatonic tones for C are F#/Gb Major pentatonic (D# minor/Eb minor pentatonic). We favor the tonal spellings of Eb minor/Gb Major pentatonic: Eb Gb Ab Bb Db for the non-diatonic tones.
We now know what all tones mean [are named] to C [we call this a tone inventory]. These tones hold a specific melodic & harmonic space to C. And, these tones only mean these to the tone C. In a different key, the tone D will be in a different position depending on the root. It is important to know the tone inventories for all keys. To help with this, please check out Tone Naming.