the 4th

Hi. Why do we use “the” here?: October the 4th

The full form would be :
the fourth day of October.
We’re using the article with that specific day.

What about this one? “October 4” Is it coorect? Are they used in the same situation?

Although it is written in that abbreviated form (and I notice some people have actually started saying it as it is written in the abbreviated form) in standard terms, these written forms:
October 4
October 4th
would still be spoken:
October the fourth.