Shrines: Shinto
A Shinto shrine (jinja) is marked by a torii gate at its entrance and is dedicated to kami — spirits or deities associated with places, natural features or ancestors. Sumiyoshi Taisha, with its distinctive pre-Buddhist architecture, and Osaka Tenmangu, home of the Tenjin Matsuri, are both Shinto shrines.
Temples: Buddhism
A Buddhist temple (usually named with -ji or -dera) centres on a Buddha statue and Buddhist teaching, often with an attached cemetery — something a Shinto shrine typically doesn't have. Shitennoji, among the oldest officially administered Buddhist temples in Japan, is Osaka's clearest example.
Why the two coexist so easily
For most of Japanese history, Shinto and Buddhism were practised together rather than as competing systems, and while they were administratively separated in the late 19th century, the cultural blending never really went away — it's common for the same person to visit a shrine for a New Year's blessing and hold a Buddhist funeral, without any sense of contradiction.
What this means for a visit
Basic etiquette differs slightly between the two — a shrine visit traditionally involves a purification step at a water basin near the entrance and a specific bow-clap-bow pattern at the main hall, while a temple visit is generally quieter and more contemplative, without the clapping. Neither requires you to be religious to visit respectfully; unhurried, quiet observation is the safest default at either.