On their way from Mexico to Alaska, gray whales are making a pit stop in San Francisco — and staying a while.

"Historically, one or two gray whales would temporarily pass underneath the Golden Gate Bridge during this time period. Last week alone, experts counted five entering the Bay," said the Marine Mammal Center in a recent press release.

Not only are more coming to town, they're also hanging out much longer than expected. One gray whale has been in and around San Francisco Bay for more than a month now.

"There is definitely something unusual going on," said Bill Keener, a whale expert with Golden Gate Cetacean Research who has been tracking the gray whales in the bay. "I've seen them at Crissy Field, Angel Island, Tiburon. There was a whale just reported off Pinole Point."

ALSO: Crazy photos show sea lion attacking leopard shark near Alcatraz

Another gray whale was reported swimming under the Bay Bridge and hanging out near Yerba Buena Island.

It's been exciting for locals and tourists who have seen a whale spout or breach right off the San Francisco coast, but the whales aren't lingering because they love the scenery and warm weather. Scientists suspect it's because the whales are starving. Because they're very hungry, they aren't able to complete the full northern migration, from Baja California to Alaska, where they spend the summer. They stop for longer mid-migration in hopes of finding food that will fuel the rest of their journey.

A few of the whales spotted in the bay have been visibly emaciated. Two whales have turned up dead.

While performing a necropsy on a dead 23-foot-long female gray whale at Angel Island last week, the Marine Mammal Center found "a significant lack of blubber and body fat" and "a lack of content in the animal's stomach." Both are signs of malnutrition.

READ MORE: Dead sperm whale won't stay away from Hawaii beaches

Starving or not, whales that spend more time in the highly trafficked San Francisco Bay are at greater risk of injury or death.

"All three are spending lots of time in shipping lanes, putting them in danger of vessel strikes," Michael Pierson, a naturalist with San Francisco Whale Tours, told SFGATE earlier this month as he tracked the presence of three gray whales. "One already has some pretty gnarly scars on its left flank."

So if the strange behavior is being spurred by starvation, what's causing the starvation? John Calambokidis, research biologist with Cascadia Research in Olympia, Wash., thinks it may have to do with a growth in the overall gray whale population. With more whales, there might not be enough food to support them all.

As for climate change, Calambokidis said "we cannot rule out" changes in the Arctic, including changes in water temperature and ice cover, which could be making the whales' food supply more sparse. However, more research is needed.

Keener agreed, "Out of 20,000 whales, I'm only seeing 10. So we need to find out more."

Read Alix Martichoux's latest stories and send her news tips at alix.martichoux@sfgate.com.

Start receiving breaking news emails on wildfires, civil emergencies, riots, national breaking news, Amber Alerts, weather emergencies, and other critical events with the SFGATE breaking news email. Click here to make sure you get the news.