If you look at the calendar, the months that have 31 days are January, March, May, July, August, October, and December. The only two months with 31 days back-to-back are July and August. Why? July was named for Julius Caesar. Augustus, meaning “father of the nation,” died on August 19, 14 AD, and was probably poisoned by his wife. So they named August after him before his death. But of course, August had 30 days and that would be slighting Augustus relative to Julius who had 31 days. So the solution was obvious. They took the extra day from February which was only named for a feast day known as the Februarius or Februa, the feast of purification, and renamed the month with 31 days equal to July.
January was named for the god Janus and March was named for Mars. You certainly didn’t want to make them angry. May was named Maius taken from the Greek Maia, or the goddess of spring. June could not be touched since that was named after the goddess Juno, the queen of the gods. July’s original name was quintilis or the fifth month in the early Roman calendar, so renaming that for Julius Caesar did not offend anyone. August was originally named sextilis or the sixth month in the early Roman calendar. September was the seventh month in the early Roman calendar and October was the eighth. November was named the ninth month and December (decimal) the tenth month.
Therefore, February was an easy month to take days from since it was named after a feast and nobody had to offend the gods.