I heard that Polish and Slovenian are both Slavic languages so how similar are they to each other? When I listen to both languages it sounds similar.
As indicated, Slovenian and Polish are from different subgroups of Slavic languages (South Slavic and West Slavic respectively). As such they are not mutually intelligible (actually spoken Czech and Polish are not very mutually intelligible, yet they are in the same group).
In phonology, Slovenian has less consonant distinctions (they mostly got rid of palatalised consonants while Polish evolved ternary system in sibilants) but more vowels distinctions (afaik they distinguished mid-close and mid-open vowels). Slovenian also lost all nasal vowels while in Polish they are preserved.
In morphology, both languages share the Slavic structural features - they both decline nouns and adjectives heavily, they conjugate verbs in similar ways and their tenses are formed from similar bases. Polish is further in development of synthetic past tense while most other Slavic languages still cling to the analytical forming with the verb "to be" (Slovenian actually is the last Slavic lanhuage to lose the aorist, i.e. the original synthetic past tense though). Slovenian also preserves the dual number for both declension and conjugation, a feature that is only very residual in all other Slavic languages.
In syntax, I would say the languages are pretty much the same - SVO word order where subject can be left unexpressed as it is pointed to by the verbal suffixes.
The largest difference will be in lexicon - the problem is not that there are words that are different, but that there are words that actually sound very similar but have a wildly different meaning.
All in all, Slovenian is much closer to Czech or Slovak than Polish, but again that applies to Polish too (being closer to Czech and Slovak than to Slovenian).
Polish and Slovenian are quite close but definitely not mutually-intelligible. Polish is a west Slavic language while Slovenian is a south Slavic language in the south-west group of languages. This means that they are far more similar to languages in each respective Slavic language sub group i.e. Polish to (Czech & Slovakian) and Slovenian to (south-west Slavic such as Bosnian ,Croatian ,Serbian and south-east Slavic Macedonian and Bulgarian). However, from my knowledge (I'm a Polish speaker), Polish is far more closer to Slovakian than Czech and by reading some Slovenian it reminds me a little of Slovakian so there is some better understanding when compared to Croatian or Bulgarian for instance. However, the grammar and vocabulary at times is far different. From my knowledge historically before the West Slavic and South Slavic language groups were split by the Austrian and Hungarian territories, mutual intelligibility would have been much higher. However, since this split these languages haven't had much contact as they have been without a common border for centuries and dialect continuum's have been formed, particularly between South Slavic languages and to a lesser extent in west Slavic, apart from Czech and Slovak. To sum it up, Polish is pretty close to Slovenian when compared to east Slavic languages (Russian, Ukrainian, Belorussian) in my opinion. There is a harder accent and the grammar and some vocabulary is quite similar. So in my opinion Polish is much closer to south-west Slavic languages more so Slovenian and even to Croatian, Bosnian and Serbian with me being able to understand about 50% mostly in writing. But Polish and Slovenian are definitely not mutually intelligible.